Bug 41588 - Link from 856$u breaks with leading or trailing spaces
Summary: Link from 856$u breaks with leading or trailing spaces
Status: Signed Off
Alias: None
Product: Koha
Classification: Unclassified
Component: Cataloging (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal
Assignee: Andrew Fuerste-Henry
QA Contact: Testopia
URL:
Keywords:
Depends on: 41081
Blocks:
  Show dependency treegraph
 
Reported: 2026-01-09 17:32 UTC by Andrew Fuerste-Henry
Modified: 2026-01-09 19:50 UTC (History)
2 users (show)

See Also:
GIT URL:
Initiative type: ---
Sponsorship status: ---
Comma delimited list of Sponsors:
Crowdfunding goal: 0
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
If a 856$u for a record had spaces before or after the URL, the link shown on the record page on the OPAC and staff interface (under 'Online resources') did not work. Depending on the browser, either nothing happened, or an error was shown that the site wasn't reachable. Examples that previously caused links not to work (without the quotes): - " koha-community.org" - "koha-community.org " - " koha-community.org "
Version(s) released in:
Circulation function:


Attachments
Bug 41588: Normalize spaces in 856$u links (5.52 KB, patch)
2026-01-09 17:45 UTC, Andrew Fuerste-Henry
Details | Diff | Splinter Review
Bug 41588: Normalize spaces in 856$u links (5.56 KB, patch)
2026-01-09 19:33 UTC, David Nind
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Fuerste-Henry 2026-01-09 17:32:05 UTC
Leading or trailing spaces in the 856$u add "%20" to the url, breaking it.

To recreate:
- add 856$u "www.cheese.com" to a record; it works!
- add 856$u " www.cheese.com" to a record; it doesn't work
- add 856$u "www.cheese.com " to a record; it doesn't work

We've got a syspref to strip those characters out when editing a record, but we may as well also deal with spaces in the XSLT for old records and/or libraries that haven't enabled the syspref.
Comment 1 Andrew Fuerste-Henry 2026-01-09 17:45:10 UTC
Created attachment 191217 [details] [review]
Bug 41588: Normalize spaces in 856$u links

To test:
1 - add 856$u " www.cheese.com" to a record
2 - confirm link does not work from results or details in either staff interface or OPAC
3 - add 856$u "www.cheese.com " to a record
4 - confirm link does not work from results or details in either staff interface or OPAC
7 - apply patch, restart_all
8 - reload pages, confirm both links work in results and details in staff interface and OPAC

Optional final step: have some cheese as a treat
Comment 2 David Nind 2026-01-09 19:33:52 UTC
Created attachment 191218 [details] [review]
Bug 41588: Normalize spaces in 856$u links

To test:
1 - add 856$u " www.cheese.com" to a record
2 - confirm link does not work from results or details in either staff interface or OPAC
3 - add 856$u "www.cheese.com " to a record
4 - confirm link does not work from results or details in either staff interface or OPAC
7 - apply patch, restart_all
8 - reload pages, confirm both links work in results and details in staff interface and OPAC

Optional final step: have some cheese as a treat

Signed-off-by: David Nind <david@davidnind.com>