Bug 21001 - OpenLibrary book covers broken
Summary: OpenLibrary book covers broken
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: OPAC (show other bugs)
Version: master
Hardware: All All
: P5 - low major (vote)
Assignee: Jonathan Druart
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-06-26 16:31 UTC by Owen Leonard
Modified: 2019-10-14 19:56 UTC (History)
3 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 21001: Add missing format=json to openlibrary calls (1.72 KB, patch)
2018-08-13 14:34 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Owen Leonard 2018-06-26 16:31:07 UTC
OpenLibrary book covers don't appear on the search results or detail page in the OPAC. The console shows an error, "SyntaxError: missing ) after argument list books:1:16246"
Comment 1 Jonathan Druart 2018-06-27 13:55:06 UTC
I suspect a bug on their side:

The answer of:
https://openlibrary.org/api/books?bibkeys=ISBN%3A067002662X%2CISBN%3A1847727808%2CISBN%3A1780335792&callback=KOHA.OpenLibrary.olCallBack&jscmd=data

is:
KOHA.OpenLibrary.olCallBack(KOHA.OpenLibrary.olCallBack({"ISBN:067002662X": {"publish_date": "2013", [SKIP]
Comment 3 Oliver Behnke 2018-08-10 09:13:38 UTC
What is the expected answer? Is this a matter of JSON vs. JS or is this about the repeated "KOHA.OpenLibrary.olCallBack" in the answer? The latter isn't the case anymore so I wonder what's wrong as still doesn't work.

Cheers
Comment 4 Oliver Behnke 2018-08-10 09:20:43 UTC
I stand corrected: I got rid of the duplication by adding "format=json" as additional query parameter. So that's a possible fix if the upstream change isn't a regression.

Cheers
Comment 5 Jonathan Druart 2018-08-13 14:34:07 UTC
Created attachment 77752 [details] [review]
Bug 21001: Add missing format=json to openlibrary calls

See https://github.com/internetarchive/openlibrary/issues/1014

Test plan:
Turn on OpenLibraryCovers and OpenLibrarySearch
Do a search at the OPAC
You should see the covers from OpenLibrary as well as the "Searching
Open Library... " and "Found XXX results in OpenLibrary collection"
info
Comment 6 Oliver Behnke 2018-08-13 14:57:05 UTC
Hi Jonathan, I'm not sure my workaround should become a solution just yet. For the time being I consider this to be an upstream API bug. So until that's cleared up upstream we probably should refrain from adjusting our query. The point being that the API docs at https://openlibrary.org/dev/docs/api/books clearly state that "callback" only makes sense in conjunction with "format=javascript" (the default), not "format=json". So either their current API or its documentation are buggy and they got to fix one of those.

Cheers
Comment 7 Jonathan Druart 2018-08-13 15:12:50 UTC
Olivier, yes you are right. I wanted to provide a patch for people who wanted to patch their installation locally. It should not be pushed until the situation has been clarified.
Comment 8 Oliver Behnke 2018-11-13 10:58:16 UTC
Hi guys,

the issue was fixed upstream and I can confirm that covers do appear again after I reverted my local patch. I'd say this ticket can be closed, ideally after someone else confirmed the fix independently.

Cheers
Comment 9 Jonathan Druart 2018-11-13 11:26:31 UTC
Thanks, looks good on my side too.