diff options
author | intrigeri <intrigeri@boum.org> | 2011-07-18 18:41:37 +0200 |
---|---|---|
committer | intrigeri <intrigeri@boum.org> | 2011-07-18 18:41:37 +0200 |
commit | 739554622fa1caa6bcc0474ebbdcd9db3627389d (patch) | |
tree | 1c7e85d06c593d3314b94477b2102dac01ba97eb /IkiWiki | |
parent | f5c8fca8875e2ad76134c15bc7717ccd21cb2e18 (diff) | |
parent | 98d2356ad0e1c3bbd823ab17fb51eaa794b26713 (diff) | |
download | ikiwiki-739554622fa1caa6bcc0474ebbdcd9db3627389d.tar ikiwiki-739554622fa1caa6bcc0474ebbdcd9db3627389d.tar.gz |
Merge commit '3.20110715' into prv/po
Diffstat (limited to 'IkiWiki')
-rw-r--r-- | IkiWiki/Plugin/attachment.pm | 8 | ||||
-rw-r--r-- | IkiWiki/Plugin/remove.pm | 3 | ||||
-rw-r--r-- | IkiWiki/Plugin/rename.pm | 4 |
3 files changed, 8 insertions, 7 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; } diff --git a/IkiWiki/Plugin/remove.pm b/IkiWiki/Plugin/remove.pm index b94447020..14ac01c9b 100644 --- a/IkiWiki/Plugin/remove.pm +++ b/IkiWiki/Plugin/remove.pm @@ -120,10 +120,9 @@ sub removal_confirm ($$@) { # Special case for unsaved attachments. foreach my $page (@pages) { - if (IkiWiki::Plugin::attachment->can("is_held_attachment")) { + if ($attachment && IkiWiki::Plugin::attachment->can("is_held_attachment")) { my $f=IkiWiki::Plugin::attachment::is_held_attachment($page); if (defined $f) { - print STDERR "!! remove $f\n"; require IkiWiki::Render; IkiWiki::prune($f); } diff --git a/IkiWiki/Plugin/rename.pm b/IkiWiki/Plugin/rename.pm index aa1081756..8e32d41ae 100644 --- a/IkiWiki/Plugin/rename.pm +++ b/IkiWiki/Plugin/rename.pm @@ -184,7 +184,7 @@ sub rename_start ($$$$) { my $held=$attachment && IkiWiki::Plugin::attachment->can("is_held_attachment") && IkiWiki::Plugin::attachment::is_held_attachment($page); - if (! defined $held) { + if (! $held) { check_canrename($page, $pagesources{$page}, undef, undef, $q, $session); } @@ -322,7 +322,7 @@ sub sessioncgi ($$) { my $held=$q->param("attachment") && IkiWiki::Plugin::attachment->can("is_held_attachment") && IkiWiki::Plugin::attachment::is_held_attachment($src); - if (defined $held) { + if ($held) { rename($held, IkiWiki::Plugin::attachment::attachment_holding_location($dest)); postrename($session, $src, $dest, $q->param("attachment")) unless defined $srcfile; |