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;
}
}
# 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;