]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - IkiWiki/Plugin/attachment.pm
attachment: Fix several utf-8 problems.
[git.ikiwiki.info.git] / IkiWiki / Plugin / attachment.pm
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") ;
 
-       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};
@@ -189,9 +189,10 @@ sub formbuilder (@) {
                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")) {
+                       $f=Encode::decode_utf8($f);
                        $f=~s/^$page\///;
                        $add.="[[$f]]\n";
                }