https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40394

--- Comment #2 from Frédéric Demians <[email protected]> ---
Created attachment 207684
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=207684&action=edit
Bug 40394: Request Coce cover images in chunks

The Coce client sent every identifier found on the page in a single
request. With many results per page, this overloads the Coce server,
and a Coce server limiting the number of IDs per request (100 by
default) rejects it: no cover is displayed at all.

This patch replaces the JSONP (very old school technique) call with a
small Coce client that sends the identifiers in chunks of at most 100,
in parallel. It also caches the answers for the life of the page.

The previous code removed 1x1 pixel images (Amazon placeholders) once
loaded. This is no longer needed. Coce filters them out at the source.

As the client now uses fetch() instead of JSONP, a Content-Security-Policy
must allow the Coce server in connect-src (it was script-src before).
Some tweaking may be necessary due to recent Koha CSP controls.

TEST PLAN / KTD instance / default DB / MARC21 :

1. Set the sysorefs :
   - OpacCoce: Enable
   - CoceHost: https://coce.tamil.fr
   - CoceProviders: all
   - OPACnumSearchResults: 200
2. In the OPAC, search for "the" (more than 100 results with an ISBN on
   the page). Open the browser developer tools, Network tab, filter on
   "coce.tamil.fr".
   - A single request is sent to Coce, with all the ISBNs.
   - Coce answers 400 "Too many IDs, maximum is 100".
   - No cover image from Coce is displayed.
3. Apply the patch, reload the page (with cache reset) => Two requests
   are sent to Coce: one with 100 ISBNs, one with the remaining ones.
   Both answer 200.  => Cover images are displayed.
4. Set OPACnumSearchResults back to 20, search again.
   => A single request, cover images displayed.
5. Open the detail page of a record with an ISBN.
   => Its cover image is displayed.

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to