]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - IkiWiki/Plugin/autoindex.pm
passwordauth: prevent authentication bypass via multiple name parameters
[git.ikiwiki.info.git] / IkiWiki / Plugin / autoindex.pm
index d0261858104cdc2783709c7fafda468b94b975b4..c443f01d241d056ca1939fdd5cbe948b2dfc2e58 100644 (file)
@@ -7,6 +7,7 @@ use IkiWiki 3.00;
 use Encode;
 
 sub import {
+       hook(type => "checkconfig", id => "autoindex", call => \&checkconfig);
        hook(type => "getsetup", id => "autoindex", call => \&getsetup);
        hook(type => "refresh", id => "autoindex", call => \&refresh);
        IkiWiki::loadplugin("transient");
@@ -28,6 +29,12 @@ sub getsetup () {
                },
 }
 
+sub checkconfig () {
+       if (! defined $config{autoindex_commit}) {
+               $config{autoindex_commit} = 1;
+       }
+}
+
 sub genindex ($) {
        my $page=shift;
        my $file=newpagefile($page, $config{default_pageext});
@@ -39,6 +46,7 @@ sub genindex ($) {
 
                        my $dir = $config{srcdir};
                        if (! $config{autoindex_commit}) {
+                               no warnings 'once';
                                $dir = $IkiWiki::Plugin::transient::transientdir;
                        }
 
@@ -73,6 +81,7 @@ sub refresh () {
                                $file=~s/^\.\/?//;
                                return unless length $file;
                                if (IkiWiki::file_pruned($file)) {
+                                       no warnings 'once';
                                        $File::Find::prune=1;
                                }
                                elsif (! -l $_) {
@@ -82,7 +91,7 @@ sub refresh () {
                                        if (! -d _) {
                                                $pages{pagename($f)}=1;
                                        }
-                                       elsif ($dir eq $config{srcdir}) {
+                                       elsif ($dir eq $config{srcdir} || ! $config{autoindex_commit}) {
                                                $dirs{$f}=1;
                                        }
                                }