[Bug 32551] New: API requests don't carry language related information
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32551 Bug ID: 32551 Summary: API requests don't carry language related information Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: normal Priority: P5 - low Component: REST API Assignee: koha-bugs@lists.koha-community.org Reporter: katrin.fischer@bsz-bw.de CC: tomascohen@gmail.com During our ILL development we noticed that there are issues with translations and the API. Using the C4::Languages::getlanguage method from the API controller is not working because the cookies is not passed and the environment variables are lost. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32551 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=30005 -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32551 Michaela Sieber <michaela.sieber@kit.edu> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |clemens.tubach@kit.edu, | |michaela.sieber@kit.edu -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32551 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |m.de.rooy@rijksmuseum.nl, | |martin.renvoize@ptfs-europe | |.com --- Comment #1 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- As part of our work on an ILL backend we have implemented this solution in Koha/REST/V1/Illrequests.pm. It works really well, but of course only for this small part. Is there way the solution could be generalized? Koha/REST/V1/Illrequests.pm sub list { my $c = shift->openapi->valid_input or return; eval { $ENV{HTTP_ACCEPT_LANGUAGE} = $c->req->cookie('KohaOpacLanguage')->value; }; return try { -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32551 Michaela Sieber <michaela.sieber@kit.edu> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |lukasz.koszyk@kit.edu, | |raphael.straub@kit.edu -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32551 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |rel_23_11_candidate -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32551 --- Comment #2 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Any way we could help to move this forward? -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32551 --- Comment #3 from Tomás Cohen Arazi <tomascohen@gmail.com> --- (In reply to Katrin Fischer from comment #2)
Any way we could help to move this forward?
You did. Thanks for the reminder 🎗️ -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32551 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Patch complexity|--- |Trivial patch Status|NEW |Needs Signoff -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32551 --- Comment #4 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 160354 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=160354&action=edit Bug 32551: Regression tests -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32551 --- Comment #5 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 160355 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=160355&action=edit 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 -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32551 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords|rel_23_11_candidate | Assignee|koha-bugs@lists.koha-commun |tomascohen@gmail.com |ity.org | -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32551 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32551 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #160354|0 |1 is obsolete| | --- Comment #6 from David Nind <david@davidnind.com> --- Created attachment 160358 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=160358&action=edit Bug 32551: Regression tests Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32551 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #160355|0 |1 is obsolete| | --- Comment #7 from David Nind <david@davidnind.com> --- Created attachment 160359 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=160359&action=edit 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> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32551 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32551 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #160358|0 |1 is obsolete| | Attachment #160359|0 |1 is obsolete| | --- Comment #8 from Nick Clemens <nick@bywatersolutions.com> --- Created attachment 160585 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=160585&action=edit Bug 32551: Regression tests Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32551 --- Comment #9 from Nick Clemens <nick@bywatersolutions.com> --- Created attachment 160586 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=160586&action=edit 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> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32551 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Pushed to master Version(s)| |24.05.00 released in| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32551 --- Comment #10 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Pushed for 24.05! Well done everyone, thank you! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32551 Fridolin Somers <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)|24.05.00 |24.05.00,23.11.02 released in| | CC| |fridolin.somers@biblibre.co | |m Status|Pushed to master |Pushed to stable --- Comment #11 from Fridolin Somers <fridolin.somers@biblibre.com> --- Pushed to 23.11.x for 23.11.02 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32551 Lucas Gass <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to stable |Pushed to oldstable CC| |lucas@bywatersolutions.com Version(s)|24.05.00,23.11.02 |24.05.00,23.11.02,23.05.08 released in| | --- Comment #12 from Lucas Gass <lucas@bywatersolutions.com> --- Backported to 23.05.x for upcoming 23.05.08 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32551 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC|martin.renvoize@ptfs-europe | |.com | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32551 Julian Maurice <julian.maurice@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |38630 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38630 [Bug 38630] Make the REST API respect KohaOpacLanguage cookie -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32551 Wainui Witika-Park <wainuiwitikapark@catalyst.net.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)|24.05.00,23.11.02,23.05.08 |24.05.00,23.11.02,23.05.08, released in| |22.11.28 CC| |wainuiwitikapark@catalyst.n | |et.nz Resolution|--- |FIXED Status|Pushed to oldstable |RESOLVED --- Comment #13 from Wainui Witika-Park <wainuiwitikapark@catalyst.net.nz> --- Applied to 22.11 for 22.11.28 -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org