aboutsummaryrefslogtreecommitdiff
path: root/IkiWiki
diff options
context:
space:
mode:
authorJoey Hess <joey@kitenet.net>2011-07-11 21:35:46 -0400
committerJoey Hess <joey@kitenet.net>2011-07-11 21:35:46 -0400
commitd23786cb6c5b3320d4b0c45df3424acea51e90ad (patch)
tree83e2edc3e1e2a8e3be62b9638e5cf3e215a88e17 /IkiWiki
parent29132999071d015de664da5f4e87c20896351ea7 (diff)
downloadikiwiki-d23786cb6c5b3320d4b0c45df3424acea51e90ad.tar
ikiwiki-d23786cb6c5b3320d4b0c45df3424acea51e90ad.tar.gz
attachment: Bugfix to create directory when moving attachment out of holding area.
Diffstat (limited to 'IkiWiki')
-rw-r--r--IkiWiki/Plugin/attachment.pm8
1 files changed, 5 insertions, 3 deletions
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;
}