diff --git a/app/dexter.pl b/app/dexter.pl index 0198af5..efdb21a 100755 --- a/app/dexter.pl +++ b/app/dexter.pl @@ -120,6 +120,18 @@ helper render_index => sub ($c) { my $user = $c->req->env->{REMOTE_USER}; my $path = $url->path; + if ( not -d $ROOT_DIRECTORY . $path->to_route ) { + $path->trailing_slash(0); + $path = $path->to_dir; + $url->path($path); + + $c->render(template => 'error', + status => '404', + message => 'That file does not exist!'); + + return 0; + } + if ( not user_has_permission_on_path($user, 'READ', $path) ) { $c->render(template => 'error', status => '403',