Bug 28159

Summary: URI-encode existing values put into query string for z39.50 authority search
Product: Koha Reporter: Phil Ringnalda <phil>
Component: MARC Authority data supportAssignee: Phil Ringnalda <phil>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: trivial    
Priority: P5 - low CC: andrew, fridolin.somers, victor
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
21.05.00,20.11.06,20.05.12
Circulation function:
Attachments: Bug 28159: URI-encode existing values put into query string for z39.50 authority search
Bug 28159: URI-encode existing values put into query string for z39.50 authority search
Bug 28159: URI-encode existing values put into query string for z39.50 authority search

Description Phil Ringnalda 2021-04-16 16:33:54 UTC
If you have a Corporate Name authority record with 100$a containing Arthur Andersen & Co. and you click the Replace record via Z39.50/SRU search button, the Author (corporate) search field in the popup window is filled with "Arthur Andersen " because the unescaped & is treated as the start of the next query param.
Comment 1 Phil Ringnalda 2021-04-16 17:06:10 UTC
Created attachment 119768 [details] [review]
Bug 28159: URI-encode existing values put into query string for z39.50 authority search

When you trigger a z39.50 search from an existing authority record, Koha
prefills the search form with the value in the record. But because that
value passes through a URL, if it isn't URI-encoded characters like & or ;
will cut off the value.

Test plan:
1) Authorities - New authority - Corporate Name
2) Tab 1, click "HEADING-CORPORATE NAME" to expand subfields
3) Subfield a, type foo & bar ; baz
4) Click Z39.50/SRU search
5) Ensure the whole string appears in the Author (corporate) field in
   the popup
Comment 2 Owen Leonard 2021-04-21 13:39:44 UTC
Created attachment 119949 [details] [review]
Bug 28159: URI-encode existing values put into query string for z39.50 authority search

When you trigger a z39.50 search from an existing authority record,
Koha prefills the search form with the value in the record. But because
that value passes through a URL, if it isn't URI-encoded characters like
& or ; will cut off the value.

Test plan:
1) Authorities - New authority - Corporate Name
2) Tab 1, click "HEADING-CORPORATE NAME" to expand subfields
3) Subfield a, type foo & bar ; baz
4) Click Z39.50/SRU search
5) Ensure the whole string appears in the Author (corporate) field in
   the popup

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Comment 3 Nick Clemens (kidclamp) 2021-05-07 18:38:58 UTC
Created attachment 120713 [details] [review]
Bug 28159: URI-encode existing values put into query string for z39.50 authority search

When you trigger a z39.50 search from an existing authority record,
Koha prefills the search form with the value in the record. But because
that value passes through a URL, if it isn't URI-encoded characters like
& or ; will cut off the value.

Test plan:
1) Authorities - New authority - Corporate Name
2) Tab 1, click "HEADING-CORPORATE NAME" to expand subfields
3) Subfield a, type foo & bar ; baz
4) Click Z39.50/SRU search
5) Ensure the whole string appears in the Author (corporate) field in
   the popup

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 4 Jonathan Druart 2021-05-10 14:18:39 UTC
Pushed to master for 21.05, thanks to everybody involved!
Comment 5 Fridolin Somers 2021-05-12 14:53:30 UTC
Pushed to 20.11.x for 20.11.06
Comment 6 Andrew Fuerste-Henry 2021-05-25 13:12:52 UTC
Pushed to 20.05.x for 20.05.12
Comment 7 Victor Grousset/tuxayo 2021-05-25 14:39:20 UTC
Not backported to oldoldstable (19.11.x). Feel free to ask if it's needed.