summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--IkiWiki/Plugin/getsource.pm11
1 files changed, 11 insertions, 0 deletions
diff --git a/IkiWiki/Plugin/getsource.pm b/IkiWiki/Plugin/getsource.pm
index 6a208f1e7..1b7eb56c6 100644
--- a/IkiWiki/Plugin/getsource.pm
+++ b/IkiWiki/Plugin/getsource.pm
@@ -66,6 +66,17 @@ sub cgi_getsource ($) {
exit;
}
+ if (! defined pagetype($IkiWiki::pagesources{$page})) {
+ IkiWiki::cgi_custom_failure(
+ $cgi->header(-status => "403 Forbidden"),
+ IkiWiki::misctemplate(gettext("not a page"),
+ "<p>".
+ sprintf(gettext("%s is an attachment, not a page."),
+ htmllink("", "", $page)).
+ "</p>"));
+ exit;
+ }
+
my $data = IkiWiki::readfile(IkiWiki::srcfile($IkiWiki::pagesources{$page}));
if (! $config{getsource_mimetype}) {