Return 500 when file or index is not readable to Dexter.
This commit is contained in:
parent
453d6ab787
commit
ea4332d207
|
@ -28,6 +28,7 @@ Readonly::Hash my %MEANING_OF_HTTP_CODE => (
|
|||
'404' => 'File Not Found',
|
||||
'409' => 'Conflict',
|
||||
'413' => 'Payload Too Large',
|
||||
'500' => 'Internal Server Error',
|
||||
);
|
||||
|
||||
Readonly my $ROOT_DIRECTORY => 'public';
|
||||
|
@ -120,6 +121,18 @@ helper render_index => sub ($c) {
|
|||
my $user = $c->req->env->{REMOTE_USER};
|
||||
my $path = $url->path;
|
||||
|
||||
if ( not -r $ROOT_DIRECTORY . $path->to_route ) {
|
||||
$path->trailing_slash(0);
|
||||
$path = $path->to_dir;
|
||||
$url->path($path);
|
||||
|
||||
$c->render(template => 'error',
|
||||
status => '500',
|
||||
message => 'Dexter cannot read that file or index!');
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ( not -d $ROOT_DIRECTORY . $path->to_route ) {
|
||||
$path->trailing_slash(0);
|
||||
$path = $path->to_dir;
|
||||
|
|
Loading…
Reference in New Issue