- # Must be editiable.
- IkiWiki::check_canedit($page, $q, $session);
-
- # This is sorta overkill, but better safe
- # than sorry. If a user can't upload an
- # attachment, don't let them delete it.
- if ($attachment) {
- IkiWiki::Plugin::attachment::check_canattach($session, $page, $file);
+ # If a user can't upload an attachment, don't let them delete it.
+ # This is sorta overkill, but better safe than sorry.
+ if (! defined pagetype($pagesources{$page})) {
+ if (IkiWiki::Plugin::attachment->can("check_canattach")) {
+ IkiWiki::Plugin::attachment::check_canattach($session, $page, "$dir/$file");
+ }
+ else {
+ error("removal of attachments is not allowed");
+ }