getsource: don't allow getting the source of an attachment
Serving up images etc. as text/plain; charset=utf-8 is unlikely to work very well, and there's no point in having this CGI action for attachments (since they're copied into the output as-is anyway).master
parent
0afcec7346
commit
ea244ab7b5
|
@ -66,6 +66,17 @@ sub cgi_getsource ($) {
|
||||||
exit;
|
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}));
|
my $data = IkiWiki::readfile(IkiWiki::srcfile($IkiWiki::pagesources{$page}));
|
||||||
|
|
||||||
if (! $config{getsource_mimetype}) {
|
if (! $config{getsource_mimetype}) {
|
||||||
|
|
Loading…
Reference in New Issue