aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--IkiWiki/Plugin/attachment.pm8
-rw-r--r--IkiWiki/Plugin/remove.pm11
2 files changed, 12 insertions, 7 deletions
diff --git a/IkiWiki/Plugin/attachment.pm b/IkiWiki/Plugin/attachment.pm
index f97ab45a4..f8a3a68c6 100644
--- a/IkiWiki/Plugin/attachment.pm
+++ b/IkiWiki/Plugin/attachment.pm
@@ -160,18 +160,16 @@ sub attachment_holding_dir {
IkiWiki::possibly_foolish_untaint(linkpage($page));
}
-sub remove_held_attachment {
+sub is_held_attachment {
my $attachment=shift;
my $f=attachment_holding_dir($attachment);
$f=~s/\/$//;
if (-f $f) {
- require IkiWiki::Render;
- IkiWiki::prune($f);
- return 1;
+ return $f
}
else {
- return 0;
+ return undef;
}
}
diff --git a/IkiWiki/Plugin/remove.pm b/IkiWiki/Plugin/remove.pm
index 5e5b83349..e6f7e1dbd 100644
--- a/IkiWiki/Plugin/remove.pm
+++ b/IkiWiki/Plugin/remove.pm
@@ -120,8 +120,15 @@ sub removal_confirm ($$@) {
# Special case for unsaved attachments.
@pages=grep {
- ! (IkiWiki::Plugin::attachment->can("remove_held_attachment") &&
- IkiWiki::Plugin::attachment::remove_held_attachment($_))
+ if (IkiWiki::Plugin::attachment->can("is_held_attachment")) {
+ my $f=IkiWiki::Plugin::attachment::is_held_attachment($_);
+ if (defined $f) {
+ require IkiWiki::Render;
+ IkiWiki::prune($f);
+ 0;
+ }
+ }
+ 1;
} @pages;
return unless @pages;