# Pastebin ac3E1Adg diff --git a/app.pl b/app.pl --- a/app.pl +++ b/app.pl @@ -8,12 +8,18 @@ get '(*dir)/:file' => sub { my $self = shift; my $dir = $self->param('dir'); my $file = $self->param('file'); + unless (-f "html/$dir/$file.html") { + return $self->render(template => 'does_not_exist'); + } return $self->redirect_to("/$dir/$file.html"); }; get '(*dir)/' => sub { my $self = shift; my $dir = $self->param('dir'); + unless (-d "html/$dir") { + return $self->render(template => 'does_not_exist'); + } return $self->redirect_to("/$dir.html"); };