[Bug 27748] New: Encoding problem in link to OverDrive results
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27748 Bug ID: 27748 Summary: Encoding problem in link to OverDrive results Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: normal Priority: P5 - low Component: OPAC Assignee: oleonard@myacpl.org Reporter: magnus@libriotech.no QA Contact: testopia@bugs.koha-community.org If you have OverDrive enabled and do a search in the OPAC, you get a link that says e.g. "Found 1 results in the library's OverDrive collection". But if you search contains non-ASCII characters, the search goes wrong. Example: Do a search for "göteborg": https://kohaopac.alingsas.se/cgi-bin/koha/opac-search.pl?q=g%C3%B6teborg (The URL shows the query as q=göteborg, but when I paste it here it is turned into q=g%C3%B6teborg.) The link says: Found 4 results in the library's OverDrive collection The actual link is: https://kohaopac.alingsas.se/cgi-bin/koha/opac-overdrive-search.pl?q=g%F6teb... If you foloow that link you get to this page: https://kohaopac.alingsas.se/cgi-bin/koha/opac-overdrive-search.pl?q=g%F6teb... which says "OverDrive search for 'g�teborg'" and shows 53 results, because the query was cut off at the "ö", and a search was actually made for just the letter "g" (whatever comes before the first non-ascii-char). If I change the encoding in the link from: https://kohaopac.alingsas.se/cgi-bin/koha/opac-overdrive-search.pl?q=g%F6teb... to: https://kohaopac.alingsas.se/cgi-bin/koha/opac-overdrive-search.pl?q=g%C3%B6... or https://kohaopac.alingsas.se/cgi-bin/koha/opac-overdrive-search.pl?q=göteborg the page shows 4 results, as promised. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27748 --- Comment #1 from Magnus Enger <magnus@libriotech.no> --- Tested on 20.05.05 and 20.05.08. I *think* the problem is the "escape" on line 934 of koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt: $overdrive_results.html( '<a href="/cgi-bin/koha/opac-overdrive-search.pl?q=' + escape( od_querystring ) + '">' + MSG_RESULTS_FOUND_IN_COLLECTION.format(data.totalItems, 'OverDrive') + '</a>' ); -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27748 --- Comment #2 from Magnus Enger <magnus@libriotech.no> --- "Bug 26578: Clean overdrive searches before passing to OD" touches the relevant parts of the code, but as far as I can see, it does not fix the encoding problem. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27748 Magnus Enger <magnus@libriotech.no> changed: What |Removed |Added ---------------------------------------------------------------------------- Patch complexity|--- |Trivial patch Status|NEW |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27748 --- Comment #3 from Magnus Enger <magnus@libriotech.no> --- Created attachment 117194 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=117194&action=edit Bug 27748 - Encoding problem in link to OverDrive results If you have OverDrive enabled and do a search for e.g. "Göteborg", you will get a link above the regular Koha search results that says e.g. "Found 1 results in the library's OverDrive collection". If you follow this link, a search will be made in OverDrive, but only for "G", because the search term is cut off at the first non-ASCII char. To test: - Make sure OverDrive is enabled - Do a search that contains a non-ASCII char, like "Göteborg" - Click on the link "Found x results in the library's OverDrive collection" - Verify the query string is cut off at the first non-ASCII char, and that the number of hits is different from the number given in the link on the previous page - Apply the patch, restart all the things - Repeat the search, and verify that the numbers match and that the query string is intact after clicking on the OverDrive link Lookin at the code, the same problem seems to be shared between OverDrive and RecordedBooks. I have applied the same fix to both, but I do not have access to RecordedBooks, so I have not been able to verify that the problem exists there and is fixed by my patch. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27748 --- Comment #4 from Magnus Enger <magnus@libriotech.no> --- Technical note: It looks like the use of escape() has been deprecated in favour of encodeURI and encodeURIComponent: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Obj... I have replaced two occurrences of escape with encodeURIComponent. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27748 Phil Ringnalda <phil@chetcolibrary.org> 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=27748 Phil Ringnalda <phil@chetcolibrary.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #117194|0 |1 is obsolete| | --- Comment #5 from Phil Ringnalda <phil@chetcolibrary.org> --- Created attachment 118481 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=118481&action=edit Bug 27748 - Encoding problem in link to OverDrive results If you have OverDrive enabled and do a search for e.g. "Göteborg", you will get a link above the regular Koha search results that says e.g. "Found 1 results in the library's OverDrive collection". If you follow this link, a search will be made in OverDrive, but only for "G", because the search term is cut off at the first non-ASCII char. To test: - Make sure OverDrive is enabled - Do a search that contains a non-ASCII char, like "Göteborg" - Click on the link "Found x results in the library's OverDrive collection" - Verify the query string is cut off at the first non-ASCII char, and that the number of hits is different from the number given in the link on the previous page - Apply the patch, restart all the things - Repeat the search, and verify that the numbers match and that the query string is intact after clicking on the OverDrive link Lookin at the code, the same problem seems to be shared between OverDrive and RecordedBooks. I have applied the same fix to both, but I do not have access to RecordedBooks, so I have not been able to verify that the problem exists there and is fixed by my patch. Signed-off-by: Phil Ringnalda <phil@chetcolibrary.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27748 Phil Ringnalda <phil@chetcolibrary.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |phil@chetcolibrary.org -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27748 Katrin Fischer <katrin.fischer@bsz-bw.de> 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=27748 --- Comment #6 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Created attachment 119166 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=119166&action=edit Bug 27748: Encoding problem in link to OverDrive results If you have OverDrive enabled and do a search for e.g. "Göteborg", you will get a link above the regular Koha search results that says e.g. "Found 1 results in the library's OverDrive collection". If you follow this link, a search will be made in OverDrive, but only for "G", because the search term is cut off at the first non-ASCII char. To test: - Make sure OverDrive is enabled - Do a search that contains a non-ASCII char, like "Göteborg" - Click on the link "Found x results in the library's OverDrive collection" - Verify the query string is cut off at the first non-ASCII char, and that the number of hits is different from the number given in the link on the previous page - Apply the patch, restart all the things - Repeat the search, and verify that the numbers match and that the query string is intact after clicking on the OverDrive link Lookin at the code, the same problem seems to be shared between OverDrive and RecordedBooks. I have applied the same fix to both, but I do not have access to RecordedBooks, so I have not been able to verify that the problem exists there and is fixed by my patch. Signed-off-by: Phil Ringnalda <phil@chetcolibrary.org> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27748 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|oleonard@myacpl.org |magnus@libriotech.no -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27748 --- Comment #7 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Trusting that Magnus and Phil have tested this with access to Overdrive. Change makes sense and I will move this to PQA with a code review only. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27748 --- Comment #8 from Phil Ringnalda <phil@chetcolibrary.org> --- Correct: I tested with Overdrive, and Magnus' link from comment 0 to show the problem no longer shows the problem, because he is running with his patch :) -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27748 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jonathan.druart@bugs.koha-c | |ommunity.org Attachment #118481|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27748 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Pushed to master Version(s)| |21.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=27748 --- Comment #9 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Pushed to master for 21.05, thanks to everybody involved! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27748 Fridolin Somers <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to master |Pushed to stable Version(s)|21.05.00 |21.05.00,20.11.05 released in| | CC| |fridolin.somers@biblibre.co | |m --- Comment #10 from Fridolin Somers <fridolin.somers@biblibre.com> --- Pushed to 20.11.x for 20.11.05 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27748 Andrew Fuerste-Henry <andrew@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |andrew@bywatersolutions.com --- Comment #11 from Andrew Fuerste-Henry <andrew@bywatersolutions.com> --- Doesn't apply cleanly to 20.05, please rebase for backport. I'm not entirely confident in my ability to clear the merge errors correctly and don't have credentials with which to check my work with a real search. Thanks! -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org