Bug 34314

Summary: CustomCoverImagesURL doesn't work if there are more than one placeholder
Product: Koha Reporter: Caroline Cyr La Rose <caroline.cyr-la-rose>
Component: System AdministrationAssignee: Bugs List <koha-bugs>
Status: NEW --- QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: gmcharlt
Version: unspecified   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Attachments: A MARC21 record for a Project Gutenberg title

Description Caroline Cyr La Rose 2023-07-19 21:02:23 UTC
Created attachment 153692 [details]
A MARC21 record for a Project Gutenberg title

I was trying to test CustomCoverImages with images from Project Gutenberg and leslibraires.ca, and I can't seem to make it work. I'm wondering if it's because in those two cases, the URL must have two placeholders.

I added a Project Gutenberg MARC21 record to test.

It's specific image is https://www.gutenberg.org/cache/epub/1736/pg1736.cover.medium.jpg 
The 1736 is the PG number, which is in 001.

For leslibraires.ca, it's a similar situation, where the URL contains the ISBN twice.

To test:

1. Import the attached record
   1.1. Download the record
   1.2. In the staff interface, go to Cataloging > Stage records for import
   1.3. Choose the file
   1.4. Click Upload file
   1.5. Click Stage for import
   1.6. (Wait until the job is done)
   1.7. Click View batch
   1.8. Click Import this batch into the catalog
   1.9. (Wait until the job is done)

2. Set up CustomCoverImages
   2.1. Go to Administration > System preferences
   2.2. Search for CustomCoverImages
   2.3. Set up the prefs as follows
        - CustomCoverImages : Show
        - OPACCustomCoverImages : Show
        - CustomCoverImagesURL : https://www.gutenberg.org/cache/epub/{001}/pg{001}.cover.medium.jpg
   2.4. Click Save all enhanced content preferences

3. View the record in the staff interface
   3.1. Search the catalog for Shakespeare or Lord Cromwell
   --> No cover image

4. View the record in the OPAC
   4.1. Click on OPAC view: Open in new window.
   --> No image