Bugzilla – Attachment 160359 Details for
Bug 32551
API requests don't carry language related information
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 32551: HTTP_ACCEPT_LANGUAGE legacy CGI variable not set in Mojolicious
Bug-32551-HTTPACCEPTLANGUAGE-legacy-CGI-variable-n.patch (text/plain), 1.75 KB, created by
David Nind
on 2023-12-28 19:12:24 UTC
(
hide
)
Description:
Bug 32551: HTTP_ACCEPT_LANGUAGE legacy CGI variable not set in Mojolicious
Filename:
MIME Type:
Creator:
David Nind
Created:
2023-12-28 19:12:24 UTC
Size:
1.75 KB
patch
obsolete
>From b5174b2c10d82c51efe5fad7e7800a0c956a6cea Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Thu, 28 Dec 2023 14:41:39 +0000 >Subject: [PATCH] Bug 32551: HTTP_ACCEPT_LANGUAGE legacy CGI variable not set > in Mojolicious > >This patch addresses the fact some of our code still relies on those CGI-era ENV variables. >In particular, C4::Laguages::getlanguage expects it to calculate the most suitable language. > >As this is reported as required, I provide a fix. > >I did a `git grep HTTP_` on the codebase, and the only other occurences are: > >* C4::Output (HTTP_X_REQUESTED_WITH) >* C4::Context (HTTP_USER_AGENT, HTTP_X_FORWARDED_FOR) >* C4::Auth_with_shibboleth (using HTTP_ variables for matchpoints) >* Some handling on the 'Koha as a Mojo app' code >* Some .pl script not relevant to this report > >I decided to limit this patch to the requested header which seems harmless. I leave the >other cases. > >To test: >1. Apply the regression tests patch >2. Run: > $ ktd --shell > k$ qa -c 1 >=> FAIL: Tests fail! >3. Apply this patch >4. Run: > k$ qa -c 2 >=> SUCCESS: Tests pass! All green! >5. Sign off :-D > >Signed-off-by: David Nind <david@davidnind.com> >--- > Koha/REST/V1/Auth.pm | 5 +++++ > 1 file changed, 5 insertions(+) > >diff --git a/Koha/REST/V1/Auth.pm b/Koha/REST/V1/Auth.pm >index b04fcaeb62..11cd523188 100644 >--- a/Koha/REST/V1/Auth.pm >+++ b/Koha/REST/V1/Auth.pm >@@ -160,6 +160,11 @@ sub authenticate_api_request { > $c->stash_embed( { spec => $spec } ); > $c->stash_overrides(); > >+ # FIXME: Remove once CGI is not used >+ my $accept_language = $c->req->headers->accept_language; >+ $ENV{HTTP_ACCEPT_LANGUAGE} = $accept_language >+ if $accept_language; >+ > my $cookie_auth = 0; > > my $authorization = $spec->{'x-koha-authorization'}; >-- >2.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 32551
:
160354
|
160355
|
160358
|
160359
|
160585
|
160586