Fix Amazon response when cover is not found #17
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
awsI 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.