]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - IkiWiki/Plugin/attachment.pm
Added a comment: I'm trying to use OpenID without success
[git.ikiwiki.info.git] / IkiWiki / Plugin / attachment.pm
index d8e2f627150e62bdaa4c4ed80a80bb8731f971bb..5a180cd5cf3c3eaac5282ef267982327e49eba8d 100644 (file)
@@ -272,12 +272,15 @@ sub attachments_save {
        my @attachments;
        my $dir=attachment_holding_location($form->field('page'));
        foreach my $filename (glob("$dir/*")) {
+               $filename=Encode::decode_utf8($filename);
                next unless -f $filename;
-               my $dest=$config{srcdir}."/".
+               my $destdir=$config{srcdir}."/".
                        linkpage(IkiWiki::possibly_foolish_untaint(
-                               attachment_location($form->field('page')))).
-                       IkiWiki::basename($filename);
+                               attachment_location($form->field('page'))));
+               my $destfile=IkiWiki::basename($filename);
+               my $dest=$destdir.$destfile;
                unlink($dest);
+               IkiWiki::prep_writefile($destfile, $destdir);
                rename($filename, $dest);
                push @attachments, $dest;
        }
@@ -343,6 +346,7 @@ sub attachment_list ($) {
        my $dir=attachment_holding_location($page);
        my $heldmsg=gettext("this attachment is not yet saved");
        foreach my $file (glob("$dir/*")) {
+               $file=Encode::decode_utf8($file);
                next unless -f $file;
                my $base=IkiWiki::basename($file);
                my $f=$loc.$base;