]> sipb.mit.edu Git - ikiwiki.git/blobdiff - IkiWiki/Plugin/recentchanges.pm
decode utf-8 in recentchanges_link parameter
[ikiwiki.git] / IkiWiki / Plugin / recentchanges.pm
index 04a878b20f0b494ea03a81dc5ed92da536c8ebec..563ab7db1950e1d9ca4863d54784a86ca2bd47ea 100644 (file)
@@ -4,6 +4,7 @@ package IkiWiki::Plugin::recentchanges;
 use warnings;
 use strict;
 use IkiWiki 2.00;
+use Encode;
 
 sub import { #{{{
        hook(type => "getsetup", id => "recentchanges", call => \&getsetup);
@@ -16,16 +17,20 @@ sub import { #{{{
 
 sub getsetup () { #{{{
        return
+               plugin => {
+                       safe => 1,
+                       rebuild => 1,
+               },
                recentchangespage => {
                        type => "string",
-                       default => "recentchanges",
+                       example => "recentchanges",
                        description => "name of the recentchanges page",
                        safe => 1,
                        rebuild => 1,
                },
                recentchangesnum => {
-                       type => "int",
-                       default => 100,
+                       type => "integer",
+                       example => 100,
                        description => "number of changes to track",
                        safe => 1,
                        rebuild => 0,
@@ -82,7 +87,7 @@ sub cgi ($) { #{{{
                # page they link to is deleted, or newly created, or
                # changes for whatever reason. So this CGI handles that
                # dynamic linking stuff.
-               my $page=$cgi->param("page");
+               my $page=decode_utf8($cgi->param("page"));
                if (!defined $page) {
                        error("missing page parameter");
                }
@@ -99,7 +104,12 @@ sub cgi ($) { #{{{
                                "</p>");
                }
                else {
-                       IkiWiki::redirect($cgi, $config{url}.IkiWiki::beautify_urlpath("/".htmlpage($link)));
+                       if (defined pagetype($link)) {
+                               IkiWiki::redirect($cgi, $config{url}.IkiWiki::beautify_urlpath("/".htmlpage($link)));
+                       }
+                       else {
+                               IkiWiki::redirect($cgi, $config{url}.IkiWiki::beautify_urlpath("/".$link));
+                       }
                }
 
                exit;