Bug 30262 - opac/tracklinks.pl inconsistent with GetMarcUrls for whitespace
Summary: opac/tracklinks.pl inconsistent with GetMarcUrls for whitespace
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: master
Hardware: All All
: P5 - low normal (vote)
Assignee: David Cook
QA Contact: Katrin Fischer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-03-10 03:58 UTC by David Cook
Modified: 2022-11-18 01:18 UTC (History)
3 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
22.11.00, 22.05.07, 21.11.14


Attachments
Bug 30262: Trim whitespace off tracklinks.pl URLs (1.40 KB, patch)
2022-03-10 04:13 UTC, David Cook
Details | Diff | Splinter Review
Bug 30262: Trim whitespace off tracklinks.pl URLs (1.45 KB, patch)
2022-08-26 07:38 UTC, David Cook
Details | Diff | Splinter Review
Bug 30262: Trim whitespace off tracklinks.pl URLs (1.68 KB, patch)
2022-08-26 07:44 UTC, Magnus Enger
Details | Diff | Splinter Review
Bug 30262: Trim whitespace off tracklinks.pl URLs (1.73 KB, patch)
2022-08-28 12:14 UTC, Katrin Fischer
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description David Cook 2022-03-10 03:58:12 UTC
C4::Biblio::GetMarcUrls will trim whitespace from URLs but opac/tracklinks.pl does not. This means that valid URLs with extra whitespace will fail validation when they should pass validation.
Comment 1 David Cook 2022-03-10 04:13:09 UTC Comment hidden (obsolete)
Comment 2 David Cook 2022-08-26 07:38:30 UTC Comment hidden (obsolete)
Comment 3 Magnus Enger 2022-08-26 07:44:53 UTC
Created attachment 139817 [details] [review]
Bug 30262: Trim whitespace off tracklinks.pl URLs

This patch trims whitespace off tracklinks.pl URLs so that
the URL is in the same format as the URLs returned by
C4::Biblio::GetMarcUrls, which is used by tracklinks.pl internally.

Test plan:
0. Apply patch and koha-plack --restart kohadev
1. Go to http://localhost:8081/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=29
2. Add a 856 with $u of 'https://koha-community.org ' (note the space at the end0
3. Save record
4. Change 'TrackClicks' syspref to 'Track'
5. Go to http://localhost:8080/cgi-bin/koha/opac-detail.pl?biblionumber=29
6. Click on the online resource (eg
http://localhost:8080/cgi-bin/koha/tracklinks.pl?uri=https%3A%2F%2Fkoha-community.org%20&biblionumber=29
)
7. Note you are redirected to https://koha-community.org

Signed-off-by: Magnus Enger <magnus@libriotech.no>
Added the link with a space at the end. Verified that without the
patch, clickin on "Click here to access online" gives a 404. After
applying the patch the redirect works as expected.
Comment 4 Katrin Fischer 2022-08-28 12:14:33 UTC
Created attachment 139909 [details] [review]
Bug 30262: Trim whitespace off tracklinks.pl URLs

This patch trims whitespace off tracklinks.pl URLs so that
the URL is in the same format as the URLs returned by
C4::Biblio::GetMarcUrls, which is used by tracklinks.pl internally.

Test plan:
0. Apply patch and koha-plack --restart kohadev
1. Go to http://localhost:8081/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=29
2. Add a 856 with $u of 'https://koha-community.org ' (note the space at the end0
3. Save record
4. Change 'TrackClicks' syspref to 'Track'
5. Go to http://localhost:8080/cgi-bin/koha/opac-detail.pl?biblionumber=29
6. Click on the online resource (eg
http://localhost:8080/cgi-bin/koha/tracklinks.pl?uri=https%3A%2F%2Fkoha-community.org%20&biblionumber=29
)
7. Note you are redirected to https://koha-community.org

Signed-off-by: Magnus Enger <magnus@libriotech.no>
Added the link with a space at the end. Verified that without the
patch, clickin on "Click here to access online" gives a 404. After
applying the patch the redirect works as expected.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 5 Tomás Cohen Arazi 2022-08-31 11:51:54 UTC
Pushed to master for 22.11.

Nice work everyone, thanks!
Comment 6 Lucas Gass 2022-10-31 17:58:09 UTC
Backported to 22.05.x for upcoming 22.05.07 release
Comment 7 Arthur Suzuki 2022-11-14 10:55:36 UTC
applied to 21.11.x for 21.11.14
Comment 8 Victor Grousset/tuxayo 2022-11-18 01:18:51 UTC
Not backported to oldoldstable (21.05.x). Feel free to ask if it's needed.

Nothing to document it seems, marking resolved.