X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/258b75c4f787ec2709a1cb089f839333cbf4f071..6b0ac401cdbe3a0e4a6997411542e1e0598ccbe5:/IkiWiki/Plugin/attachment.pm?ds=inline diff --git a/IkiWiki/Plugin/attachment.pm b/IkiWiki/Plugin/attachment.pm index d8e2f6271..fd4096edf 100644 --- a/IkiWiki/Plugin/attachment.pm +++ b/IkiWiki/Plugin/attachment.pm @@ -273,11 +273,13 @@ sub attachments_save { my $dir=attachment_holding_location($form->field('page')); foreach my $filename (glob("$dir/*")) { 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; }