Merge pull request #2944 from bblommers/s3_deleteobjects_golang

Fix S3:DeleteObjects in GoLang
This commit is contained in:
Steve Pulec 2020-05-01 15:47:17 -05:00 committed by GitHub
commit ba65c641ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 3 deletions

View File

@ -137,8 +137,13 @@ def parse_key_name(pth):
def is_delete_keys(request, path, bucket_name):
return path == "/?delete" or (
path == "/" and getattr(request, "query_string", "") == "delete"
# GOlang sends a request as url/?delete= (treating it as a normal key=value, even if the value is empty)
# Python sends a request as url/?delete (treating it as a flag)
# https://github.com/spulec/moto/issues/2937
return (
path == "/?delete"
or path == "/?delete="
or (path == "/" and getattr(request, "query_string", "") == "delete")
)

View File

@ -3765,7 +3765,7 @@ def test_paths_with_leading_slashes_work():
@mock_s3
def test_root_dir_with_empty_name_works():
if os.environ.get("TEST_SERVER_MODE", "false").lower() == "true":
if settings.TEST_SERVER_MODE:
raise SkipTest("Does not work in server mode due to error in Workzeug")
store_and_read_back_a_key("/")