Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bad error response when manifest is stripped #153

Merged
merged 5 commits into from
Nov 8, 2022

Conversation

mauricefisher64
Copy link
Collaborator

Changes in this pull request

Fix bad error code when manifest is stripped and XMP reference is present

Checklist

  • This PR represents a single feature, fix, or change.
  • All applicable changes have been documented.
  • Any TO DO items (or similar) have been entered as GitHub issues and the link to that issue has been included in a comment.

Copy link
Collaborator

@gpeacock gpeacock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The idea behind the RemoteManifestUrl error is that we are returning the URL so that it can be fetched externally when fetch_remote_manifest is disabled. So we don't want to add extra text to the url in that case, just return the url.

@codecov-commenter
Copy link

codecov-commenter commented Nov 8, 2022

Codecov Report

Merging #153 (11daadb) into main (42cb1c0) will increase coverage by 0.05%.
The diff coverage is 93.33%.

@@            Coverage Diff             @@
##             main     #153      +/-   ##
==========================================
+ Coverage   78.27%   78.33%   +0.05%     
==========================================
  Files          67       67              
  Lines       14684    14698      +14     
==========================================
+ Hits        11494    11513      +19     
+ Misses       3190     3185       -5     
Impacted Files Coverage Δ
sdk/src/store.rs 85.26% <93.33%> (+0.38%) ⬆️
make_test_images/src/make_test_images.rs 67.78% <0.00%> (-0.42%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@mauricefisher64
Copy link
Collaborator Author

Well, this case is different. The reason this failure is that it is a remote url but the feature is disabled. What to you want to return here?

@gpeacock
Copy link
Collaborator

gpeacock commented Nov 8, 2022

There are two remote errors defined as follows:

#[error("could not fetch the remote manifest")]
RemoteManifestFetch(String),

#[error("must fetch remote manifests from url")]
RemoteManifestUrl(String),

The first should be used when we have a valid url, try to fetch it and fail.
The second is for this case where fetching is disabled, so the caller will need to fetch the URL externally.

@gpeacock
Copy link
Collaborator

gpeacock commented Nov 8, 2022

On RemoteManifestUrl, it is important that only the URL itself is returned so that the caller can read it and attempt to fetch the URL on their own.

@dkozma
Copy link
Contributor

dkozma commented Nov 8, 2022

Should there be a test case for this? Also, when testing on my side, I saw it try to fetch a local JUMBF url as if it was a remote URL - is this expected?

@mauricefisher64
Copy link
Collaborator Author

Should there be a test case for this? Also, when testing on my side, I saw it try to fetch a local JUMBF url as if it was a remote URL - is this expected?

You must have an old version. That was changed in a prior PR.

Copy link
Collaborator

@gpeacock gpeacock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good. I'm not crazy about adding yet another jpeg just to test this case, But it is a good idea to have a test case for it. Perhaps when I get around to generating the images for unit tests, I'll add one to generate this case.

@mauricefisher64 mauricefisher64 merged commit 0b9faad into main Nov 8, 2022
@mauricefisher64 mauricefisher64 deleted the bad_error_code branch November 8, 2022 22:39
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.

None yet

4 participants