aboutsummaryrefslogtreecommitdiff
path: root/IkiWiki.pm
diff options
context:
space:
mode:
authorJoey Hess <joey@kitenet.net>2010-04-23 16:20:02 -0400
committerJoey Hess <joey@kitenet.net>2010-04-23 16:20:02 -0400
commit96c9c8aa925120423fc563dbf233c73fc805288b (patch)
treec56d3c4bbc13b3a0e2afb7ff29f730a07334431e /IkiWiki.pm
parent7e79da76332b93214a7d9a5c91bc046db4219ee2 (diff)
downloadikiwiki-96c9c8aa925120423fc563dbf233c73fc805288b.tar
ikiwiki-96c9c8aa925120423fc563dbf233c73fc805288b.tar.gz
fix return of tpage
Diffstat (limited to 'IkiWiki.pm')
-rw-r--r--IkiWiki.pm20
1 files changed, 12 insertions, 8 deletions
diff --git a/IkiWiki.pm b/IkiWiki.pm
index 78612cd08..7382f11e4 100644
--- a/IkiWiki.pm
+++ b/IkiWiki.pm
@@ -1661,16 +1661,20 @@ sub template_file ($) {
}
my $template=srcfile($tpage, 1);
- if (defined $template) {
- return $template, $tpage if wantarray;
- return $template;
+ if (! defined $template) {
+ $name=~s:/::; # avoid path traversal
+ foreach my $dir ($config{templatedir},
+ "$installdir/share/ikiwiki/templates") {
+ if (-e "$dir/$name") {
+ $template="$dir/$name";
+ last;
+ }
+ }
}
- $name=~s:/::; # avoid path traversal
-
- foreach my $dir ($config{templatedir},
- "$installdir/share/ikiwiki/templates") {
- return "$dir/$name" if -e "$dir/$name";
+ if (defined $template) {
+ return $template, $tpage if wantarray;
+ return $template;
}
return;
}