mirror of
https://github.com/derf/travelynx
synced 2024-12-02 17:29:11 +00:00
consistently return HTTP 404 on not found errors
This commit is contained in:
parent
c1635e24fb
commit
ab04bc19b9
2 changed files with 26 additions and 15 deletions
|
@ -66,7 +66,7 @@ sub profile {
|
|||
my $user = $self->users->get_privacy_by( name => $name );
|
||||
|
||||
if ( not $user ) {
|
||||
$self->render('not_found');
|
||||
$self->render( 'not_found', status => 404 );
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -437,11 +437,11 @@ sub user_status {
|
|||
"/p/${name}/j/$journey->{id}?token=${token}-${ts}");
|
||||
}
|
||||
else {
|
||||
$self->render('not_found');
|
||||
$self->render( 'not_found', status => 404 );
|
||||
}
|
||||
return;
|
||||
}
|
||||
$self->render('not_found');
|
||||
$self->render( 'not_found', status => 404 );
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -550,7 +550,7 @@ sub status_card {
|
|||
delete $self->stash->{layout};
|
||||
|
||||
if ( not $user ) {
|
||||
$self->render('not_found');
|
||||
$self->render( 'not_found', status => 404 );
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -1222,7 +1222,7 @@ sub year_in_review {
|
|||
# -> Limit time range to avoid accidental DoS.
|
||||
if ( not( $year =~ m{ ^ [0-9]{4} $ }x and $year > 1990 and $year < 2100 ) )
|
||||
{
|
||||
$self->render('not_found');
|
||||
$self->render( 'not_found', status => 404 );
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1244,8 +1244,11 @@ sub year_in_review {
|
|||
);
|
||||
|
||||
if ( not @journeys ) {
|
||||
$self->render( 'not_found',
|
||||
message => 'Keine Zugfahrten im angefragten Jahr gefunden.' );
|
||||
$self->render(
|
||||
'not_found',
|
||||
message => 'Keine Zugfahrten im angefragten Jahr gefunden.',
|
||||
status => 404
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1253,9 +1256,11 @@ sub year_in_review {
|
|||
if (
|
||||
not( $year < $now->year or ( $now->month == 12 and $now->day == 31 ) ) )
|
||||
{
|
||||
$self->render( 'not_found',
|
||||
$self->render(
|
||||
'not_found',
|
||||
message =>
|
||||
'Der aktuelle Jahresrückblick wird erst zum Jahresende (am 31.12.) freigeschaltet'
|
||||
'Der aktuelle Jahresrückblick wird erst zum Jahresende (am 31.12.) freigeschaltet',
|
||||
status => 404
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
@ -1287,7 +1292,7 @@ sub yearly_history {
|
|||
# -> Limit time range to avoid accidental DoS.
|
||||
if ( not( $year =~ m{ ^ [0-9]{4} $ }x and $year > 1990 and $year < 2100 ) )
|
||||
{
|
||||
$self->render('not_found');
|
||||
$self->render( 'not_found', status => 404 );
|
||||
return;
|
||||
}
|
||||
my $interval_start = DateTime->new(
|
||||
|
@ -1312,8 +1317,11 @@ sub yearly_history {
|
|||
}
|
||||
|
||||
if ( not @journeys ) {
|
||||
$self->render( 'not_found',
|
||||
message => 'Keine Zugfahrten im angefragten Jahr gefunden.' );
|
||||
$self->render(
|
||||
'not_found',
|
||||
status => 404,
|
||||
message => 'Keine Zugfahrten im angefragten Jahr gefunden.'
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1365,7 +1373,7 @@ sub monthly_history {
|
|||
and $month < 13 )
|
||||
)
|
||||
{
|
||||
$self->render('not_found');
|
||||
$self->render( 'not_found', status => 404 );
|
||||
return;
|
||||
}
|
||||
my $interval_start = DateTime->new(
|
||||
|
@ -1386,8 +1394,11 @@ sub monthly_history {
|
|||
);
|
||||
|
||||
if ( not @journeys ) {
|
||||
$self->render( 'not_found',
|
||||
message => 'Keine Zugfahrten im angefragten Monat gefunden.' );
|
||||
$self->render(
|
||||
'not_found',
|
||||
message => 'Keine Zugfahrten im angefragten Monat gefunden.',
|
||||
status => 404
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue