Skip to content

Conversation

@taskula
Copy link

@taskula taskula commented Jan 30, 2025

By using provider "aws" in Coce, a result in JSON response is always returned whether cover image is found or not.

It seems Amazon is returning a 1x1 pixel gif when cover is not found. Looking at your aws fetcher I imagine it previously returned HTTP 404 or something similar, but now it returns a HTTP 200 and this 1x1 image when no cover is found.

To reproduce:

Make a request to Coce server:

http://coce.server/cover?id=0000000000&provider=aws

Observe response:

{"0000000000":"https://images-na.ssl-images-amazon.com/images/P/0000000000.01.MZZZZZZZZZ.jpg"}

Open the returned URL in your browser and observe 1x1 gif.

Expected response:

{}

As we use a HEAD request for aws I propose we examine Content-Length response header for 43 bytes that is the size of this 1x1 gif. If Content-Length is something else then we expect a cover was found and return URL in our response.

@fredericd
Copy link
Owner

Thanks. Very intersting perspective. I've tested with your example: id=0000000000. And I get the strange result you describe. Your patch is a solution. I've then tested with other values, and I find other results, and even more strange. For example, with id=0000000001, or id=0000000002, the returned value is:

https://images-na.ssl-images-amazon.com/images/P/0000000001.01.MZZZZZZZZZ.jpg
https://images-na.ssl-images-amazon.com/images/P/0000000002.01.MZZZZZZZZZ.jpg

What game is Amazon playing?

@taskula
Copy link
Author

taskula commented Jan 30, 2025

Another question, what is the case for accepting a HTTP 403 response code? Do they really provide an image together with 403 response code?

(referring to)

coce/coce.js

Line 67 in 8c7f96e

if (res.statusCode === 200 || res.statusCode === 403) repo.addurl('aws', id, url);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants