summaryrefslogtreecommitdiff
path: root/lib/Travelynx/Controller/Traveling.pm
diff options
context:
space:
mode:
authorDerf Null <derf@finalrewind.org>2023-06-04 19:37:16 +0200
committerDerf Null <derf@finalrewind.org>2023-06-04 19:37:16 +0200
commitab04bc19b9694d906125345e516c89fd0c4626f1 (patch)
treec65c4301504e28383c89b37d7357fad86782d1ca /lib/Travelynx/Controller/Traveling.pm
parentc1635e24fb78d981a790463cfe35ba552bcaac04 (diff)
consistently return HTTP 404 on not found errors
Diffstat (limited to 'lib/Travelynx/Controller/Traveling.pm')
-rwxr-xr-xlib/Travelynx/Controller/Traveling.pm33
1 files changed, 22 insertions, 11 deletions
diff --git a/lib/Travelynx/Controller/Traveling.pm b/lib/Travelynx/Controller/Traveling.pm
index 80214ab..2463bb5 100755
--- a/lib/Travelynx/Controller/Traveling.pm
+++ b/lib/Travelynx/Controller/Traveling.pm
@@ -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;
}