]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - IkiWiki/Plugin/404.pm
pagestats: rename disp to show, and document it
[git.ikiwiki.info.git] / IkiWiki / Plugin / 404.pm
index 5550ea7d19dda10131344385358b65e6ed3bb81e..42cfa9e8aad04fc69b050df92b38a18905a33495 100644 (file)
@@ -10,6 +10,7 @@ use IkiWiki 3.00;
 
 sub import {
        hook(type => "cgi", id => '404',  call => \&cgi);
 
 sub import {
        hook(type => "cgi", id => '404',  call => \&cgi);
+       hook(type => "getsetup", id => '404',  call => \&getsetup);
        IkiWiki::loadplugin("goto");
 }
 
        IkiWiki::loadplugin("goto");
 }
 
@@ -21,6 +22,7 @@ sub getsetup () {
                        # server admin action too
                        safe => 0,
                        rebuild => 0,
                        # server admin action too
                        safe => 0,
                        rebuild => 0,
+                       section => "web",
                }
 }
 
                }
 }
 
@@ -67,8 +69,10 @@ sub cgi_page_from_404 ($$$) {
 sub cgi ($) {
        my $cgi=shift;
 
 sub cgi ($) {
        my $cgi=shift;
 
-       if ($ENV{REDIRECT_STATUS} eq '404') {
-               my $page = cgi_page_from_404($ENV{REDIRECT_URL},
+       if (exists $ENV{REDIRECT_STATUS} && 
+           $ENV{REDIRECT_STATUS} eq '404') {
+               my $page = cgi_page_from_404(
+                       Encode::decode_utf8($ENV{REDIRECT_URL}),
                        $config{url}, $config{usedirs});
                IkiWiki::Plugin::goto::cgi_goto($cgi, $page);
        }
                        $config{url}, $config{usedirs});
                IkiWiki::Plugin::goto::cgi_goto($cgi, $page);
        }