summaryrefslogtreecommitdiff
path: root/IkiWiki.pm
diff options
context:
space:
mode:
authorJoey Hess <joey@kitenet.net>2010-04-23 15:02:07 -0400
committerJoey Hess <joey@kitenet.net>2010-04-23 15:02:07 -0400
commit78fd3b35a2805489185a14e00b53b450eec961f1 (patch)
treebfe42959228eb1e50bbf90e4679eefe56fafe9e3 /IkiWiki.pm
parentee8d237f98b2c82b441dc7c26f6ce8545362cb73 (diff)
allow template pages to not be under templates/
Diffstat (limited to 'IkiWiki.pm')
-rw-r--r--IkiWiki.pm4
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") {