Add proper 404 page.
This commit is contained in:
parent
2926fd52cd
commit
453d6ab787
|
@ -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',
|
||||
|
|
Loading…
Reference in New Issue