diff options
author | Joey Hess <joey@kitenet.net> | 2010-04-23 15:02:07 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2010-04-23 15:02:07 -0400 |
commit | 78fd3b35a2805489185a14e00b53b450eec961f1 (patch) | |
tree | bfe42959228eb1e50bbf90e4679eefe56fafe9e3 /IkiWiki.pm | |
parent | ee8d237f98b2c82b441dc7c26f6ce8545362cb73 (diff) |
allow template pages to not be under templates/
Diffstat (limited to 'IkiWiki.pm')
-rw-r--r-- | IkiWiki.pm | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/IkiWiki.pm b/IkiWiki.pm index 03441b594..78612cd08 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm @@ -1654,7 +1654,7 @@ sub saveindex () { sub template_file ($) { my $name=shift; - my $tpage="templates/$name"; + my $tpage=($name =~ /^\//) ? $name : "templates/$name"; if ($name !~ /\.tmpl$/ && exists $pagesources{$tpage}) { $tpage=$pagesources{$tpage}; $name.=".tmpl"; @@ -1665,6 +1665,8 @@ sub template_file ($) { return $template, $tpage if wantarray; return $template; } + + $name=~s:/::; # avoid path traversal foreach my $dir ($config{templatedir}, "$installdir/share/ikiwiki/templates") { |