Bug 42283: (follow-up) URI-encode z3950 search params in GetZ3950Terms

The original template rendered each Z39.50 search param with the
"| uri" TT filter, so the generated query string was safe for
values containing spaces, ampersands or other reserved characters.

The JS port concatenates the raw values, producing a broken query
string when any search field (title, author, subject, etc.) is not
already URL-safe.

Wrap name and value in encodeURIComponent to restore the original
behaviour.

To test:
- Import or create a biblio whose title or author includes a space
  and an ampersand (e.g. "Q & A: Practical tests").
- From the cataloging search results, trigger the Z39.50 search for
  that record.
- Confirm the request URL includes correctly encoded parameters
  (space as %20, & as %26) and that the Z39.50 results load.

Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Jan Kissig <bibliothek@th-wildau.de>
Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
This commit is contained in:
Paul Derscheid 2026-04-17 12:02:16 +02:00 committed by Pedro Amorim
parent c7422c5c78
commit a4ec38d5fa
No known key found for this signature in database
GPG Key ID: 06B75BA7F3894D55
1 changed files with 1 additions and 1 deletions

View File

@ -417,7 +417,7 @@
function GetZ3950Terms(fw) {
var strQuery = "&frameworkcode=" + fw;
z3950_search_params.forEach(function (z3950_search_param) {
strQuery += "&" + z3950_search_param.name + "=" + z3950_search_param.value;
strQuery += "&" + encodeURIComponent(z3950_search_param.name) + "=" + encodeURIComponent(z3950_search_param.value);
});
return strQuery;
}