From 496279e05c0939bc18bdaa30f10765ee3ea80ee9 Mon Sep 17 00:00:00 2001 From: Andromeda Date: Fri, 18 Oct 2024 16:57:51 +0000 Subject: [PATCH 1/3] Update perl to v5.30 to fix OCI image manifest version More context: https://github.com/Perl/docker-perl/issues/161 --- .github/workflows/perl.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/perl.yml b/.github/workflows/perl.yml index 2e64b35..12a38d0 100644 --- a/.github/workflows/perl.yml +++ b/.github/workflows/perl.yml @@ -16,7 +16,7 @@ jobs: strategy: matrix: perl-version: - - '5.20' + - '5.30' - 'latest' - 'threaded' From 3e2e9cf71d4670e96148f32621c200284ad03d07 Mon Sep 17 00:00:00 2001 From: Birte Kristina Friesel Date: Wed, 23 Oct 2024 20:07:48 +0200 Subject: [PATCH 2/3] Api: perltidy --- lib/Travelynx/Controller/Api.pm | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/Travelynx/Controller/Api.pm b/lib/Travelynx/Controller/Api.pm index 0cc2c18..f4f771e 100755 --- a/lib/Travelynx/Controller/Api.pm +++ b/lib/Travelynx/Controller/Api.pm @@ -182,7 +182,7 @@ sub travel_v1 { my $from_station = sanitize( q{}, $payload->{fromStation} ); my $to_station = sanitize( q{}, $payload->{toStation} ); my $train_id; - my $hafas = sanitize(undef, $payload->{hafas}); + my $hafas = sanitize( undef, $payload->{hafas} ); $hafas //= exists $payload->{train}{journeyID} ? 'DB' : undef; if ( @@ -201,7 +201,7 @@ sub travel_v1 { error => 'Missing fromStation or train data', status => $self->get_user_status_json_v1( uid => $uid ) }, - status => 400, + status => 400, ); return; } @@ -216,7 +216,7 @@ sub travel_v1 { error => 'Unknown fromStation', status => $self->get_user_status_json_v1( uid => $uid ) }, - status => 400, + status => 400, ); return; } @@ -232,7 +232,7 @@ sub travel_v1 { error => 'Unknown toStation', status => $self->get_user_status_json_v1( uid => $uid ) }, - status => 400, + status => 400, ); return; } @@ -673,7 +673,8 @@ sub autocomplete { = "document.addEventListener('DOMContentLoaded',function(){M.Autocomplete.init(document.querySelectorAll('.autocomplete'),{\n"; $output .= 'minLength:3,limit:50,data:'; $output - .= encode_json( $self->stations->get_for_autocomplete( backend_id => $backend_id ) ); + .= encode_json( + $self->stations->get_for_autocomplete( backend_id => $backend_id ) ); $output .= "\n});});\n"; $self->render( From 481c49a3c279fa0cc684f0c0c724b248b9ac149c Mon Sep 17 00:00:00 2001 From: Birte Kristina Friesel Date: Wed, 23 Oct 2024 20:08:01 +0200 Subject: [PATCH 3/3] import: Catch errors in get_single and sanity_check --- lib/Travelynx/Controller/Api.pm | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/lib/Travelynx/Controller/Api.pm b/lib/Travelynx/Controller/Api.pm index f4f771e..b732810 100755 --- a/lib/Travelynx/Controller/Api.pm +++ b/lib/Travelynx/Controller/Api.pm @@ -571,14 +571,20 @@ sub import_v1 { my $journey; if ( not $error ) { - $journey = $self->journeys->get_single( - uid => $uid, - db => $db, - journey_id => $journey_id, - verbose => 1 - ); - $error - = $self->journeys->sanity_check( $journey, $payload->{lax} ? 1 : 0 ); + eval { + $journey = $self->journeys->get_single( + uid => $uid, + db => $db, + journey_id => $journey_id, + verbose => 1 + ); + $error + = $self->journeys->sanity_check( $journey, + $payload->{lax} ? 1 : 0 ); + }; + if ($@) { + $error = $@; + } } if ($error) {