-
Notifications
You must be signed in to change notification settings - Fork 507
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
feat: Return hinted error for S3 wildcard if-none-match #5506
Conversation
core/src/layers/correctness_check.rs
Outdated
let is_s3_wildcard_match = self.info.scheme() == Scheme::S3 && if_none_match == "*"; | ||
if !is_s3_wildcard_match || !capability.write_with_if_none_match { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One alternative might be to generalize this to:
let is_s3_wildcard_match = self.info.scheme() == Scheme::S3 && if_none_match == "*"; | |
if !is_s3_wildcard_match || !capability.write_with_if_none_match { | |
let if_none_match_wildcard = | |
if_none_match == "*" && !capability.write_with_if_not_exists; | |
if !if_none_match_wildcard || !capability.write_with_if_none_match { |
But then this would need to be reflected in all potential clients as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have reconsidered this and believe it’s better to return an error rather than modifying the behavior here to change the semantics of if_none_match
.
Provide a helpful error message if users attempt to call if_none_match("*")
on a service that supports write_with_if_not_exists
but not write_with_if_none_match
. In this scenario, the error should suggest that users switch to using if_not_exists
instead.
…d with if-none-exists
Makes sense, I've done something along those lines, let me know what you think. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's really nice, thank you @gruuya!
Which issue does this PR close?
Closes #5505.
Rationale for this change
Work-around for S3 allowing only wildcard(
*
) if-none-match requests.What changes are included in this PR?
Don't error out if the if-none-match argument is a wildcard and the scheme is S3.
Also hook-up the corresponding client argument.
Are there any user-facing changes?
if_none_match("*")
and only that should work for S3.