- my $match=match_glob($page, "$glob/*", @_);
- if ($match) {
- my $type=IkiWiki::pagetype($IkiWiki::pagesources{$page});
- if ($type ne "_comment") {
- return IkiWiki::FailReason->new("$page is not a comment");
- }
+ # To see if it's a comment, check the source file type.
+ # Deal with comments that were just deleted.
+ my $source=exists $IkiWiki::pagesources{$page} ?
+ $IkiWiki::pagesources{$page} :
+ $IkiWiki::delpagesources{$page};
+ my $type=defined $source ? IkiWiki::pagetype($source) : undef;
+ if (! defined $type || $type ne "_comment") {
+ return IkiWiki::FailReason->new("$page is not a comment");