Bug 39088

Summary: If OPACURLOpenInNewWindow is enabled, URLs without http are broken in OPAC results
Product: Koha Reporter: Caroline Cyr La Rose <caroline.cyr-la-rose>
Component: OPACAssignee: Jonathan Druart <jonathan.druart>
Status: Pushed to main --- QA Contact: Marcel de Rooy <m.de.rooy>
Severity: normal    
Priority: P5 - low CC: dcook, jonathan.druart, m.de.rooy
Version: Main   
Hardware: All   
OS: All   
GIT URL: Change sponsored?: ---
Patch complexity: Trivial patch Documentation contact:
Documentation submission: Text to go in the release notes:
Version(s) released in:
25.05.00
Circulation function:
Attachments: Record to test
Bug 39088: Correctly prefix url with protocol when OPACURLOpenInNewWindow on the OPAC result page
Bug 39088: Correctly prefix url with protocol when OPACURLOpenInNewWindow on the OPAC result page
Bug 39088: Correctly prefix url with protocol when OPACURLOpenInNewWindow on the OPAC result page

Description Caroline Cyr La Rose 2025-02-10 22:27:22 UTC
Created attachment 177713 [details]
Record to test

A client reported this and I was able to recreate on main. They have 800+ records with URLs in 856$u without the https:// at the beginning. The URLs open fine everywhere *except* the OPAC results, where the OPACBaseURL is somehow prepended to the URL in 856. If we turn off OPACURLOpenInNewWindow, the links work fine in OPAC results.

I attached one of their records as an example.

To test:
1. Import the attached record
   1.1. Go to Cataloging > Stage records for import
   1.2. Choose the file
   1.3. Click on 'Upload file'
   1.4. Click on 'Stage for import'
   1.5. Click 'View batch'
   1.6. Click 'Import this batch into the catalog'

2. In the staff interface, search for 'Statistics'

3. In the search results, hover over 'View Document - English' under the title 'Technology adoption by women-owned businesses in Canada'
   --> URL is publication.gc.ca... (OK)

4. Click on the title to access the detailed record

5. Hover over 'View Document - English'
   --> URL is publication.gc.ca... (OK)

6. In the OPAC, search for 'Statistics'

7. In the search results, hover over 'View Document - English' under the title 'Technology adoption by women-owned businesses in Canada'
   --> URL is publication.gc.ca... (OK)

8. Click on the title to access the detailed record

9. Hover over 'View Document - English'
   --> URL is publication.gc.ca... (OK)

10. Enable OPACURLOpenInNewWindow
    10.1. Go to Administration > System preferences
    10.2. Search for OPACURLOpenInNewWindow
    10.3. Change the value to 'do'
    10.4. Click 'Save all OPAC preferences'

11. Redo steps 2-9
    staff interface search results = OK
    staff interface detailed record = OK
    OPAC search results = URL is localhost:8080/cgi-bin/koha/publications.gc.ca (NOT OK)
    OPAC detailed record = OK
Comment 1 Jonathan Druart 2025-02-11 12:41:04 UTC
Created attachment 177729 [details] [review]
Bug 39088: Correctly prefix url with protocol when OPACURLOpenInNewWindow on the OPAC result page

There is certainly something better to do as the xsl for the OPACDetail
is calling it only once, but it needs more work.
Comment 2 Caroline Cyr La Rose 2025-02-11 14:12:09 UTC
Created attachment 177734 [details] [review]
Bug 39088: Correctly prefix url with protocol when OPACURLOpenInNewWindow on the OPAC result page

There is certainly something better to do as the xsl for the OPACDetail
is calling it only once, but it needs more work.

Signed-off-by: Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com>
Comment 3 Marcel de Rooy 2025-02-14 09:06:52 UTC
Created attachment 178089 [details] [review]
Bug 39088: Correctly prefix url with protocol when OPACURLOpenInNewWindow on the OPAC result page

There is certainly something better to do as the xsl for the OPACDetail
is calling it only once, but it needs more work.

Signed-off-by: Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 4 Katrin Fischer 2025-02-17 14:07:31 UTC
Pushed for 25.05!

Well done everyone, thank you!