]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/commitdiff
rename: Fix some utf-8 problems.
authorJoey Hess <joey@gnu.kitenet.net>
Mon, 14 Dec 2009 22:01:55 +0000 (17:01 -0500)
committerJoey Hess <joey@gnu.kitenet.net>
Mon, 14 Dec 2009 22:15:50 +0000 (17:15 -0500)
The crux of the problem is that the cgi object has raw values not converted
to utf-8, and rename was using its fields. Also fixed a missed place where
the form object did not get its fields utf-8 encoded.

IkiWiki/Plugin/rename.pm
debian/changelog

index c3e03496fec167591ad6564e97bff45c3e544641..8213d21f60c902985f06ae644d0d1633d7a58ce7 100644 (file)
@@ -235,6 +235,7 @@ sub formbuilder (@) {
 
        if (defined $form->field("do") && ($form->field("do") eq "edit" ||
            $form->field("do") eq "create")) {
+               IkiWiki::decode_form_utf8($form);
                my $q=$params{cgi};
                my $session=$params{session};
 
@@ -242,7 +243,7 @@ sub formbuilder (@) {
                        rename_start($q, $session, 0, $form->field("page"));
                }
                elsif ($form->submitted eq "Rename Attachment") {
-                       my @selected=$q->param("attachment_select");
+                       my @selected=map { Encode::decode_utf8($_) } $q->param("attachment_select");
                        if (@selected > 1) {
                                error(gettext("Only one attachment can be renamed at a time."));
                        }
@@ -278,7 +279,7 @@ sub sessioncgi ($$) {
 
        if ($q->param("do") eq 'rename') {
                my $session=shift;
-               my ($form, $buttons)=rename_form($q, $session, $q->param("page"));
+               my ($form, $buttons)=rename_form($q, $session, Encode::decode_utf8($q->param("page")));
                IkiWiki::decode_form_utf8($form);
 
                if ($form->submitted eq 'Cancel') {
@@ -290,9 +291,9 @@ sub sessioncgi ($$) {
 
                        # These untaints are safe because of the checks
                        # performed in check_canrename later.
-                       my $src=$q->param("page");
+                       my $src=$form->field("page");
                        my $srcfile=IkiWiki::possibly_foolish_untaint($pagesources{$src});
-                       my $dest=IkiWiki::possibly_foolish_untaint(titlepage($q->param("new_name")));
+                       my $dest=IkiWiki::possibly_foolish_untaint(titlepage($form->field("new_name")));
                        my $destfile=$dest;
                        if (! $q->param("attachment")) {
                                my $type=$q->param('type');
index 491e07a4aa4774fe25d7b63bd5200e99f428cca6..41f4ec870e4d56125ba379a449848ff554f535cb 100644 (file)
@@ -6,6 +6,7 @@ ikiwiki (3.20091203) UNRELEASED; urgency=low
   * Improve javascript onload handling.
   * monotone: Deal with format change in version 0.45.
     (Thanks, Richard Levitte)
+  * rename: Fix some utf-8 problems.
 
  -- Joey Hess <joeyh@debian.org>  Wed, 02 Dec 2009 17:22:21 -0500