oops, fix for no_chdir mode
authorJoey Hess <joey@kitenet.net>
Tue, 20 Apr 2010 18:13:46 +0000 (14:13 -0400)
committerJoey Hess <joey@kitenet.net>
Tue, 20 Apr 2010 18:21:31 +0000 (14:21 -0400)
$_ will be absolute then

IkiWiki/Plugin/autoindex.pm
IkiWiki/Plugin/comments.pm

index 1d0612e846e87e3738aea2bf945c258609bb3496..23a17d4e9d9d38a6babe413bbca766a50730119c 100644 (file)
@@ -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 _) {
index 32e4d09377001a3b769429a7b4561c26730ab091..03ca19c9876e0211db52628ae37dd69523a510e2 100644 (file)
@@ -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];