-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
S3: fix unquoting of S3 object keys in DeleteObjects #6933
S3: fix unquoting of S3 object keys in DeleteObjects #6933
Conversation
Yup.. that sounds familiar! It took me ages to get it working in the first place, but I wasn't really happy with the outcome. If you can mange to simplify the solution, that would be very welcome. For context, this was the original PR with some rationale: #6602 This is now complicated by the introduction of MotoProxy (#6848), which does not have the concept of a |
Thanks for the pointer towards MotoProxy, I had totally missed that. I will validate the failing It seems all tests that are failing, for Server and Proxy, are the following:
It might be working for MotoProxy already then? |
Just to make things interesting, I've added the I'm assuming that's not a problem, because Edit: OK, that looks good. The tests do fail, but not because of |
Yes, I actually had a wrong assumption for |
Seems like the failure might have been a flake as everything else is green? Looks this might work! 😄 |
Codecov Report
@@ Coverage Diff @@
## master #6933 +/- ##
==========================================
- Coverage 95.83% 95.83% -0.01%
==========================================
Files 830 830
Lines 81371 81328 -43
==========================================
- Hits 77983 77940 -43
Misses 3388 3388
Flags with carried forward coverage won't be shown. Click here to find out more.
|
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.
Yes, this LGTM. Awesome - thank you for fixing this @bentsku!
This is now part of moto >= 4.2.7.dev18 |
As reported in localstack/localstack#9428, moto is decoding the content of the
DeleteObjects
body, but those keys are not going through the URL encoding as they're in the XML, and should be used as is.I've removed the
get_safe_path
call fromDeleteObjects
and added a test validating the behaviour, tested against AWS.This devolved into a bit of a rabbit hole, as it seems fixing this still did not delete the keys, because they were saved with an emoji in the name where it should have been using the raw url encoded format like S3.
Result of
ListObjects
:I've changed the
get_safe_path
util to make use of WerkzeugRAW_URI
, as this contains the URI as received by the server. We can then use those proper values to construct the object key, and this circumvents all issue related to the key encoding. This is a rather big change, but if the tests are green, I believe this would be safe to do.