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 );
|
my $user = $self->users->get_privacy_by( name => $name );
|
||||||
|
|
||||||
if ( not $user ) {
|
if ( not $user ) {
|
||||||
$self->render('not_found');
|
$self->render( 'not_found', status => 404 );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -437,11 +437,11 @@ sub user_status {
|
||||||
"/p/${name}/j/$journey->{id}?token=${token}-${ts}");
|
"/p/${name}/j/$journey->{id}?token=${token}-${ts}");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$self->render('not_found');
|
$self->render( 'not_found', status => 404 );
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$self->render('not_found');
|
$self->render( 'not_found', status => 404 );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -550,7 +550,7 @@ sub status_card {
|
||||||
delete $self->stash->{layout};
|
delete $self->stash->{layout};
|
||||||
|
|
||||||
if ( not $user ) {
|
if ( not $user ) {
|
||||||
$self->render('not_found');
|
$self->render( 'not_found', status => 404 );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1222,7 +1222,7 @@ sub year_in_review {
|
||||||
# -> Limit time range to avoid accidental DoS.
|
# -> Limit time range to avoid accidental DoS.
|
||||||
if ( not( $year =~ m{ ^ [0-9]{4} $ }x and $year > 1990 and $year < 2100 ) )
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1244,8 +1244,11 @@ sub year_in_review {
|
||||||
);
|
);
|
||||||
|
|
||||||
if ( not @journeys ) {
|
if ( not @journeys ) {
|
||||||
$self->render( 'not_found',
|
$self->render(
|
||||||
message => 'Keine Zugfahrten im angefragten Jahr gefunden.' );
|
'not_found',
|
||||||
|
message => 'Keine Zugfahrten im angefragten Jahr gefunden.',
|
||||||
|
status => 404
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1253,9 +1256,11 @@ sub year_in_review {
|
||||||
if (
|
if (
|
||||||
not( $year < $now->year or ( $now->month == 12 and $now->day == 31 ) ) )
|
not( $year < $now->year or ( $now->month == 12 and $now->day == 31 ) ) )
|
||||||
{
|
{
|
||||||
$self->render( 'not_found',
|
$self->render(
|
||||||
|
'not_found',
|
||||||
message =>
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1287,7 +1292,7 @@ sub yearly_history {
|
||||||
# -> Limit time range to avoid accidental DoS.
|
# -> Limit time range to avoid accidental DoS.
|
||||||
if ( not( $year =~ m{ ^ [0-9]{4} $ }x and $year > 1990 and $year < 2100 ) )
|
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;
|
return;
|
||||||
}
|
}
|
||||||
my $interval_start = DateTime->new(
|
my $interval_start = DateTime->new(
|
||||||
|
@ -1312,8 +1317,11 @@ sub yearly_history {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( not @journeys ) {
|
if ( not @journeys ) {
|
||||||
$self->render( 'not_found',
|
$self->render(
|
||||||
message => 'Keine Zugfahrten im angefragten Jahr gefunden.' );
|
'not_found',
|
||||||
|
status => 404,
|
||||||
|
message => 'Keine Zugfahrten im angefragten Jahr gefunden.'
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1365,7 +1373,7 @@ sub monthly_history {
|
||||||
and $month < 13 )
|
and $month < 13 )
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
$self->render('not_found');
|
$self->render( 'not_found', status => 404 );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
my $interval_start = DateTime->new(
|
my $interval_start = DateTime->new(
|
||||||
|
@ -1386,8 +1394,11 @@ sub monthly_history {
|
||||||
);
|
);
|
||||||
|
|
||||||
if ( not @journeys ) {
|
if ( not @journeys ) {
|
||||||
$self->render( 'not_found',
|
$self->render(
|
||||||
message => 'Keine Zugfahrten im angefragten Monat gefunden.' );
|
'not_found',
|
||||||
|
message => 'Keine Zugfahrten im angefragten Monat gefunden.',
|
||||||
|
status => 404
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue