Bug 23527 - BakerTaylorBookstoreURL is converted to escaped characters by template, rendering it invalid
Summary: BakerTaylorBookstoreURL is converted to escaped characters by template, rende...
Status: Pushed to oldstable
Alias: None
Product: Koha
Classification: Unclassified
Component: OPAC (show other bugs)
Version: master
Hardware: All All
: P5 - low trivial (vote)
Assignee: David Kuhn
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-08-31 22:38 UTC by David Kuhn
Modified: 2020-03-10 22:48 UTC (History)
5 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Who signed the patch off:
Text to go in the release notes:
Version(s) released in:
20.05.00, 19.11.04, 19.05.09


Attachments
Bug 23527 - BakerTaylorBookstoreURL is converted to escaped characters by template, rendering it invalid (4.04 KB, patch)
2019-08-31 23:38 UTC, David Kuhn
Details | Diff | Splinter Review
Bug 23527 - BakerTaylorBookstoreURL is converted to escaped characters by template, rendering it invalid (4.27 KB, patch)
2020-02-14 14:42 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 23527: BakerTaylorBookstoreURL is converted to escaped characters by template, rendering it invalid (4.33 KB, patch)
2020-02-17 19:59 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 Kuhn 2019-08-31 22:38:58 UTC
The url stored in the preference BakerTaylorBookstoreURL is rendered in opac-detail.tt with escaped characters (including the "/", "?" and "=" characters which are designating subdirectories and parameters), thus making the resulting link invalid.

For example:

The URL used for BakerTaylorBookstoreURL is https://contentcafe2.btol.com/ContentCafeClient/ContentCafe.aspx?UserID=

However, what is rendered in the OPAC is https://contentcafe2.btol.com%2FContentCafeClient%2FContentCafe.aspx%3FUserID%3D

To test this (requires a Baker & Taylor username and id):
1. Enter 
      contentcafe2.btol.com/ContentCafeClient/ContentCafe.aspx?UserID=(your username)&Password=(your password)&ItemKey= 
into the BakerTaylorBookstoreURL preference and enable Baker & Taylor images.
2. Display a record that has a cover image in the OPAC.
3. Click on the image. You are not redirected to the above url (in firefox nothing happens, in chrome you are directed to "about:blank#blocked").
Comment 1 David Kuhn 2019-08-31 23:08:52 UTC
This also occurs in opac-search.tt.
Comment 2 David Kuhn 2019-08-31 23:15:36 UTC
Sorry, I mean opac-results.tt
Comment 3 David Kuhn 2019-08-31 23:38:08 UTC
Created attachment 92516 [details] [review]
Bug 23527 - BakerTaylorBookstoreURL is converted to escaped characters by template, rendering it invalid

Changing the template toolkit filter for rendering the value of BakerTaylorBookstoreURL in opac-detail.tt and opac-results.tt from uri to url fixes the problem.

To test (requires a Baker & Taylor username and password):
1. Enter the B&T url into BakerTaylorBookstoreURL.
2. Set BakerTaylorEnabled to "add" and enter your username and password.
3. Look up a title in the OPAC.
4. Locate a title with a cover image.
5. Click on the cover image. You are not redirected to the url stored in BakerTaylorBookstoreURL.
6. Display the full record for the title
7. Click on the cover image. You are not redirected to the url stored in BakerTaylorBookstoreURL.
8. Apply the patch.
9. Refresh the OPAC display.
10. Click on the cover image. You are now redirected to the specified url.
11. Return to the results list.
12. Click on a cover image. You are now redirected to the specified url.
Comment 4 Owen Leonard 2020-02-14 14:42:43 UTC
Created attachment 98950 [details] [review]
Bug 23527 - BakerTaylorBookstoreURL is converted to escaped characters by template, rendering it invalid

Changing the template toolkit filter for rendering the value of
BakerTaylorBookstoreURL in opac-detail.tt and opac-results.tt from uri
to url fixes the problem.

To test (requires a Baker & Taylor username and password):

1. Enter the B&T url into BakerTaylorBookstoreURL.
2. Set BakerTaylorEnabled to "add" and enter your username and password.
3. Look up a title in the OPAC.
4. Locate a title with a cover image.
5. Click on the cover image. You are not redirected to the url stored
   in BakerTaylorBookstoreURL.
6. Display the full record for the title
7. Click on the cover image. You are not redirected to the url stored
   in BakerTaylorBookstoreURL.
8. Apply the patch.
9. Refresh the OPAC display.
10. Click on the cover image. You are now redirected to the specified url.
11. Return to the results list.
12. Click on a cover image. You are now redirected to the specified url.

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

Although I don't have valid Baker & Taylor credentials I was able to use
dummy data to verify that the links in the template are correctly
encoded with this patch.
Comment 5 Katrin Fischer 2020-02-17 19:59:28 UTC
Created attachment 99127 [details] [review]
Bug 23527: BakerTaylorBookstoreURL is converted to escaped characters by template, rendering it invalid

Changing the template toolkit filter for rendering the value of
BakerTaylorBookstoreURL in opac-detail.tt and opac-results.tt from uri
to url fixes the problem.

To test (requires a Baker & Taylor username and password):

1. Enter the B&T url into BakerTaylorBookstoreURL.
2. Set BakerTaylorEnabled to "add" and enter your username and password.
3. Look up a title in the OPAC.
4. Locate a title with a cover image.
5. Click on the cover image. You are not redirected to the url stored
   in BakerTaylorBookstoreURL.
6. Display the full record for the title
7. Click on the cover image. You are not redirected to the url stored
   in BakerTaylorBookstoreURL.
8. Apply the patch.
9. Refresh the OPAC display.
10. Click on the cover image. You are now redirected to the specified url.
11. Return to the results list.
12. Click on a cover image. You are now redirected to the specified url.

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

Although I don't have valid Baker & Taylor credentials I was able to use
dummy data to verify that the links in the template are correctly
encoded with this patch.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 6 Katrin Fischer 2020-02-17 20:00:27 UTC
Hi David, just a tiny thing - the subject line of the patch always needs to start with XXXX: - fixed it during my QA.
Comment 7 Martin Renvoize 2020-02-19 11:34:24 UTC
Nice work everyone!

Pushed to master for 20.05
Comment 8 Joy Nelson 2020-03-05 01:55:23 UTC
Pushed to 19.11.x branch for 19.11.04
Comment 9 Lucas Gass 2020-03-10 22:48:20 UTC
backported to 19.05.x for 19.05.09