]> sipb.mit.edu Git - ikiwiki.git/blobdiff - IkiWiki/Plugin/remove.pm
fix removal of staged attachments
[ikiwiki.git] / IkiWiki / Plugin / remove.pm
index 5e5b83349b63dd6b5790023dcbd0b302bffa8c8d..b94447020de8f5f00cdb81776546a52a6ca00499 100644 (file)
@@ -119,10 +119,17 @@ sub removal_confirm ($$@) {
        my @pages=@_;
                
        # Special case for unsaved attachments.
-       @pages=grep {
-               ! (IkiWiki::Plugin::attachment->can("remove_held_attachment") &&
-                  IkiWiki::Plugin::attachment::remove_held_attachment($_))
-       } @pages;
+       foreach my $page (@pages) {
+               if (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);
+                       }
+               }
+       }
+       @pages=grep { exists $pagesources{$_} } @pages;
        return unless @pages;
 
        foreach my $page (@pages) {