Skip to content

Commit

Permalink
fix: Syndetics cover fails if record's UPC has a leading zero
Browse files Browse the repository at this point in the history
Caused by the checksums being wrong.

Test plan:
On adb, with ktd vanilla test data, we can use record '76' as that has a UPC with a leading zero:
http://localhost:8083/Record/76

1) Add valid syndetics settings.
2) Access the record:
  http://localhost:8083/Record/76
3) Notice the image is not found, this is because this record's UPC is '021561601628', and processImageURL is not identifying the returned image as a "not found" because it doesn't match any of the checksums it's verifying.
4) Apply the patch. Repeat the test plan. You'll need to click "Staff View" -> "Reload Cover" on the record page to clear the cover cache and force the request again but now the image should be displaying correctly. This is because the leading zeroes fail check and the returned image is properly identified as a 'not found' image, so getGroupedWorkCover will then check again but without stripping the leading zeroes, and work then.

Finally, I decided to test for the other sizes as well, and noticed all the checksums are wrong, not the just the medium. Possibly caused by a change of default 'not found' images on syndetics' end.

To test this, visit the following locally:
http://localhost:8083/bookcover.php?id=ils:76&size=small&upc=021561601628&reload=1
http://localhost:8083/bookcover.php?id=ils:76&size=medium&upc=021561601628&reload=1
http://localhost:8083/bookcover.php?id=ils:76&size=large&upc=021561601628&reload=1

None of these work before the fix. All work after the fix.
  • Loading branch information
ammopt committed Dec 19, 2024
1 parent 1e256e6 commit 15c3148
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions code/web/sys/Covers/BookCoverProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -748,13 +748,13 @@ function processImageURL($source, $url, $attemptRefetch = true) {
$imageChecksum = md5($image);
if ($imageChecksum == 'e89e0e364e83c0ecfba5da41007c9a2c') {
return false;
} elseif ($imageChecksum == 'f017f94ed618a86d0fa7cecd7112ab7e') {
} elseif ($imageChecksum == '798f904eabf783405079eaf699414801') {
//Syndetics Unbound default image at medium size
return false;
} elseif ($imageChecksum == 'dadde13fdb5f3775cdbdd25f34c0389b') {
} elseif ($imageChecksum == 'b13e33c0262a3a1f21dd20b826710cbc') {
//Syndetics Unbound default image at small size
return false;
} elseif ($imageChecksum == 'c6ddaf338cf667df0bf60045f05146db') {
} elseif ($imageChecksum == '821d0d442dbee0f51f4c803e8e9fc87a') {
//Syndetics Unbound default image at large size
return false;
}
Expand Down

0 comments on commit 15c3148

Please sign in to comment.