]> sipb.mit.edu Git - ikiwiki.git/commitdiff
attachment: Fix several utf-8 problems.
authorJoey Hess <joey@gnu.kitenet.net>
Mon, 14 Dec 2009 22:16:40 +0000 (17:16 -0500)
committerJoey Hess <joey@gnu.kitenet.net>
Mon, 14 Dec 2009 22:16:40 +0000 (17:16 -0500)
Similar to those in the rename plugin, although here we can't use
the form object.

IkiWiki/Plugin/attachment.pm
debian/changelog

index 087c315a9af355569921c9150c05c0ba89ec8df1..953e71625a24345cb323408ab43287a427828b4d 100644 (file)
@@ -112,7 +112,7 @@ sub formbuilder (@) {
 
        return if ! defined $form->field("do") || ($form->field("do") ne "edit" && $form->field("do") ne "create") ;
 
 
        return if ! defined $form->field("do") || ($form->field("do") ne "edit" && $form->field("do") ne "create") ;
 
-       my $filename=$q->param('attachment');
+       my $filename=Encode::decode_utf8($q->param('attachment'));
        if (defined $filename && length $filename &&
             ($form->submitted eq "Upload Attachment" || $form->submitted eq "Save Page")) {
                my $session=$params{session};
        if (defined $filename && length $filename &&
             ($form->submitted eq "Upload Attachment" || $form->submitted eq "Save Page")) {
                my $session=$params{session};
@@ -189,9 +189,10 @@ sub formbuilder (@) {
                IkiWiki::saveindex();
        }
        elsif ($form->submitted eq "Insert Links") {
                IkiWiki::saveindex();
        }
        elsif ($form->submitted eq "Insert Links") {
-               my $page=quotemeta($q->param("page"));
+               my $page=quotemeta(Encode::decode_utf8($q->param("page")));
                my $add="";
                foreach my $f ($q->param("attachment_select")) {
                my $add="";
                foreach my $f ($q->param("attachment_select")) {
+                       $f=Encode::decode_utf8($f);
                        $f=~s/^$page\///;
                        $add.="[[$f]]\n";
                }
                        $f=~s/^$page\///;
                        $add.="[[$f]]\n";
                }
index 41f4ec870e4d56125ba379a449848ff554f535cb..c286065fa1b7517dfd32085928fc8487111dff9f 100644 (file)
@@ -7,6 +7,7 @@ ikiwiki (3.20091203) UNRELEASED; urgency=low
   * monotone: Deal with format change in version 0.45.
     (Thanks, Richard Levitte)
   * rename: Fix some utf-8 problems.
   * monotone: Deal with format change in version 0.45.
     (Thanks, Richard Levitte)
   * rename: Fix some utf-8 problems.
+  * attachment: Fix several utf-8 problems.
 
  -- Joey Hess <joeyh@debian.org>  Wed, 02 Dec 2009 17:22:21 -0500
 
 
  -- Joey Hess <joeyh@debian.org>  Wed, 02 Dec 2009 17:22:21 -0500