fix incorrect content-type header on .md posts

This commit is contained in:
Matthew Connelly 2015-03-15 02:08:11 +00:00
parent 102e016b24
commit e8aee97d00
1 changed files with 2 additions and 3 deletions

View File

@ -185,7 +185,6 @@ sub do_cache {
set server => '127.0.0.1';
set port => 42069;
set server_tokens => 1;
hook 'before' => sub {
do_cache;
@ -203,14 +202,14 @@ get '/page/:id' => sub {
};
get '/wrote/:yyyy/:mm/:slug' => sub {
pass unless params->{yyyy} =~ /^[0-9]{4}$/ and params->{mm} =~ /^(?:0[1-9]|1[0-2])$/ and params->{slug} =~ /^[a-z0-9\-]+(?:\.md)?$/i;
$page->param(SOURCEVIEW => 1) if params->{slug} =~ s/\.md$//;
$page->param(SOURCEVIEW => 1) and header('Content-Type' => 'text/plain') if params->{slug} =~ s/\.md$//;
$page->param(ISPOST => 1);
get_post params->{yyyy}, params->{mm}, params->{slug} or pass;
return $page->output;
};
get '/:extpage' => sub {
pass unless params->{extpage} =~ /^[a-z0-9\-]+(?:\.md)?$/i;
$page->param(SOURCEVIEW => 1) if params->{extpage} =~ s/\.md$//;
$page->param(SOURCEVIEW => 1) and header('Content-Type' => 'text/plain') if params->{extpage} =~ s/\.md$//;
$page->param(ISPOST => 0);
get_page params->{extpage} or pass;
return $page->output;