summaryrefslogtreecommitdiff
path: root/IkiWiki/Plugin
diff options
context:
space:
mode:
authorJoey Hess <joey@kitenet.net>2010-04-20 14:13:46 -0400
committerJoey Hess <joey@kitenet.net>2010-04-20 14:21:31 -0400
commit1f56dead00ee1188d9ed9650b9b2483b69c4d525 (patch)
tree906624033e0b19dd4b44616f659ae875df6ee96d /IkiWiki/Plugin
parentcff3937b681a6c2505eb52b43b2e3e7086f99c45 (diff)
oops, fix for no_chdir mode
$_ will be absolute then
Diffstat (limited to 'IkiWiki/Plugin')
-rw-r--r--IkiWiki/Plugin/autoindex.pm6
-rw-r--r--IkiWiki/Plugin/comments.pm7
2 files changed, 8 insertions, 5 deletions
diff --git a/IkiWiki/Plugin/autoindex.pm b/IkiWiki/Plugin/autoindex.pm
index 1d0612e84..23a17d4e9 100644
--- a/IkiWiki/Plugin/autoindex.pm
+++ b/IkiWiki/Plugin/autoindex.pm
@@ -39,12 +39,14 @@ sub refresh () {
find({
no_chdir => 1,
wanted => sub {
- $_=decode_utf8($_);
+ my $file=decode_utf8($_);
+ $file=~s/^\Q$dir\E\/?//;
+ return unless length $file;
if (IkiWiki::file_pruned($_)) {
$File::Find::prune=1;
}
elsif (! -l $_) {
- my ($f)=/$config{wiki_file_regexp}/; # untaint
+ my ($f) = $file =~ /$config{wiki_file_regexp}/; # untaint
return unless defined $f;
return if $f =~ /\._([^.]+)$/; # skip internal page
if (! -d _) {
diff --git a/IkiWiki/Plugin/comments.pm b/IkiWiki/Plugin/comments.pm
index 32e4d0937..03ca19c98 100644
--- a/IkiWiki/Plugin/comments.pm
+++ b/IkiWiki/Plugin/comments.pm
@@ -644,13 +644,14 @@ sub comments_pending () {
find({
no_chdir => 1,
wanted => sub {
- $_=decode_utf8($_);
+ my $file=decode_utf8($_);
+ $file=~s/^\Q$dir\E\/?//;
+ return unless length $file;
if (IkiWiki::file_pruned($_)) {
$File::Find::prune=1;
}
elsif (! -l $_ && ! -d _) {
- $File::Find::prune=0;
- my ($f)=/$config{wiki_file_regexp}/; # untaint
+ my ($f) = $file =~ /$config{wiki_file_regexp}/; # untaint
if (defined $f && $f =~ /\Q._comment\E$/) {
my $ctime=(stat($f))[10];
push @ret, [$f, $ctime];