Fix Amazon response when cover is not found#17
Open
taskula wants to merge 1 commit intofredericd:masterfrom
Open
Fix Amazon response when cover is not found#17taskula wants to merge 1 commit intofredericd:masterfrom
taskula wants to merge 1 commit intofredericd:masterfrom
Conversation
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 What game is Amazon playing? |
Author
|
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) Line 67 in 8c7f96e |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.