fix removal of staged attachments
authorJoey Hess <joey@kitenet.net>
Wed, 15 Jun 2011 21:46:08 +0000 (17:46 -0400)
committerJoey Hess <joey@kitenet.net>
Wed, 15 Jun 2011 21:46:08 +0000 (17:46 -0400)
IkiWiki/Plugin/remove.pm

index e6f7e1dbd1c530e47a1accccdbcd0232723d52b1..b94447020de8f5f00cdb81776546a52a6ca00499 100644 (file)
@@ -119,17 +119,17 @@ sub removal_confirm ($$@) {
        my @pages=@_;
                
        # Special case for unsaved attachments.
-       @pages=grep {
+       foreach my $page (@pages) {
                if (IkiWiki::Plugin::attachment->can("is_held_attachment")) {
-                       my $f=IkiWiki::Plugin::attachment::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);
-                               0;
                        }
                }
-               1;
-       } @pages;
+       }
+       @pages=grep { exists $pagesources{$_} } @pages;
        return unless @pages;
 
        foreach my $page (@pages) {