turns out i forgot to strip .md$ from markdown uris before passing them on

This commit is contained in:
Matthew Connelly 2015-03-15 01:37:07 +00:00
parent d0f1de2f5d
commit b66771e3d5
1 changed files with 3 additions and 3 deletions

View File

@ -202,21 +202,21 @@ 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} =~ /\.md$/;
$page->param(SOURCEVIEW => 1) 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} =~ /\.md$/;
$page->param(SOURCEVIEW => 1) if params->{extpage} =~ s/\.md$//;
$page->param(ISPOST => 0);
get_page params->{extpage} or pass;
return $page->output;
};
# 404
any qr{.*} => sub {
return redirect '/' if request->path =~ /index(?:\.(?:htm|p)l?)?$/;
return redirect '/' if request->path =~ /index(?:\.(?:html?|pl)?)?$/;
status 'not_found';
return redirect '/404.html';
};