Bug 25428 - Escaped HTML shows in authority detail view when subfield is a link
Summary: Escaped HTML shows in authority detail view when subfield is a link
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: MARC Authority data support (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal (vote)
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-05-08 16:12 UTC by Owen Leonard
Modified: 2021-12-13 21:09 UTC (History)
2 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:
20.05.00, 19.11.07, 19.05.12


Attachments
Screenshot showing the problem (62.10 KB, image/png)
2020-05-08 16:12 UTC, Owen Leonard
Details
Bug 25428: Correctly encode link if authority subfield is a URL (3.50 KB, patch)
2020-05-08 16:23 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 25428: Correctly encode link if authority subfield is a URL (3.59 KB, patch)
2020-05-15 19:53 UTC, Bernardo Gonzalez Kriegel
Details | Diff | Splinter Review
Bug 25428: Correctly encode link if authority subfield is a URL (3.65 KB, patch)
2020-05-21 14:02 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 Owen Leonard 2020-05-08 16:12:08 UTC
Created attachment 104604 [details]
Screenshot showing the problem

In authority records there is the option to designate a subfield as a URL (like we do for 856$u in the default MARC framework). When you view the details of such a record the URL is output to the screen as HTML markup. This is because the script is sending hard-coded HTML to the template and the template outputs is as escaped.

Rather than use the $raw filter to make the link work, we should remove the script-generated HTML and do it in the template.
Comment 1 Owen Leonard 2020-05-08 16:23:12 UTC
Created attachment 104605 [details] [review]
Bug 25428: Correctly encode link if authority subfield is a URL

This patch modifies the script and template for showing the details of
an authority record so that if the authority subfield is configured to
be a link the link is correctly output in the template.

To test you must have an authority type configured with at least one
subfield designated as a URL:

 - Go to Administration -> Authority types
 - Select "MARC structure" from the actions menu for the authority type
   you want to modify.
 - Select "Subfields" from the actions menu for the tag containing
   the subfield you want to modify (for instance 856).
 - Edit the subfield you want to display as a link (e.g. subfield u).
 - In the subfield configuration form under "Advanced constraints" check
   the "Is a URL" checkbox and save your changes.

 - Apply the patch and go to Authorities in the staff interface.
 - Search for or create an authority record which contains URL
   information in the right subfield (for instance 856$u).
 - View the details for the record. Using the 856 example, the "8" tab
   should contain an active link pointing to the correct URL.
Comment 2 Bernardo Gonzalez Kriegel 2020-05-15 19:53:12 UTC
Created attachment 104967 [details] [review]
Bug 25428: Correctly encode link if authority subfield is a URL

This patch modifies the script and template for showing the details of
an authority record so that if the authority subfield is configured to
be a link the link is correctly output in the template.

To test you must have an authority type configured with at least one
subfield designated as a URL:

 - Go to Administration -> Authority types
 - Select "MARC structure" from the actions menu for the authority type
   you want to modify.
 - Select "Subfields" from the actions menu for the tag containing
   the subfield you want to modify (for instance 856).
 - Edit the subfield you want to display as a link (e.g. subfield u).
 - In the subfield configuration form under "Advanced constraints" check
   the "Is a URL" checkbox and save your changes.

 - Apply the patch and go to Authorities in the staff interface.
 - Search for or create an authority record which contains URL
   information in the right subfield (for instance 856$u).
 - View the details for the record. Using the 856 example, the "8" tab
   should contain an active link pointing to the correct URL.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Work as described, no errors
Comment 3 Katrin Fischer 2020-05-21 14:02:38 UTC
Created attachment 105200 [details] [review]
Bug 25428: Correctly encode link if authority subfield is a URL

This patch modifies the script and template for showing the details of
an authority record so that if the authority subfield is configured to
be a link the link is correctly output in the template.

To test you must have an authority type configured with at least one
subfield designated as a URL:

 - Go to Administration -> Authority types
 - Select "MARC structure" from the actions menu for the authority type
   you want to modify.
 - Select "Subfields" from the actions menu for the tag containing
   the subfield you want to modify (for instance 856).
 - Edit the subfield you want to display as a link (e.g. subfield u).
 - In the subfield configuration form under "Advanced constraints" check
   the "Is a URL" checkbox and save your changes.

 - Apply the patch and go to Authorities in the staff interface.
 - Search for or create an authority record which contains URL
   information in the right subfield (for instance 856$u).
 - View the details for the record. Using the 856 example, the "8" tab
   should contain an active link pointing to the correct URL.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Work as described, no errors

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 4 Martin Renvoize 2020-05-22 08:33:58 UTC
Nice work everyone!

Pushed to master for 20.05
Comment 5 Aleisha Amohia 2020-06-10 03:37:34 UTC
backported to 19.11.x for 19.11.07
Comment 6 Victor Grousset/tuxayo 2020-06-12 01:16:53 UTC
Backported to 19.05.x branch for 19.05.12