Priority: Urgent
Current State: Closed
Released In: 2.1.1
Target Release: patch
In Foswiki 2.1, the filter applied to template names in the function _readTemplateFile (in Templates.pm) has changed. The value of the is copied from the
AttachmentNameFilter preference and its default value omits "/" which was allowed in _readTemplateFile by the previous filter value.
Foswiki 2.0.3:
$name =~ s/[^A-Za-z0-9_,.\/]//g;
Foswiki 2.1:
$name =~ s/$Foswiki::regex{filenameInvalidCharRegex}//g;
where
$regex{filenameInvalidCharRegex} = qr/$Foswiki::cfg{AttachmentNameFilter}/;
and
$Foswiki::cfg{AttachmentNameFilter} = "[\\*?~^$@%`"'&|<>/\[\]#\x00-\x1f]"
In a Foswiki installation containing a hierarchical web structure such that web Y is a subweb of X, and web Y contains topics P and T where topic P contains a
%COMMENT{template="T"}%
macro, the Comment plugin calls
Func::readTemplate("X/Y.T")
. This request fails because the "/" is ultimately filtered out of the topic name when it reaches Template::_readTemplateFile.
Because
CommentPlugin normalizes the web name, it is not possible to work around this issue using an explicit path in dot notation ("X.Y.T"). I don't see any other obvious work-arounds beyond moving the template topic out of the subweb.
--
PaulMerchantJr - 08 Mar 2016
Thanks for the detailed debugging. I think the fix is to use the
NameFilter instead of
AttachmentNameFilter when validating a template name. This should allow the slash.
--
GeorgeClark - 09 Mar 2016