S3 - avoid encoding of / (#5261)

This commit is contained in:
Cristopher Pinzón 2022-06-24 17:55:20 -05:00 committed by GitHub
parent 7d8c05ebee
commit 20a2218ddc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View File

@ -163,7 +163,7 @@ class FakeKey(BaseModel, ManagedState):
def safe_name(self, encoding_type=None):
if encoding_type == "url":
return urllib.parse.quote(self.name, safe="")
return urllib.parse.quote(self.name)
return self.name
@property

View File

@ -152,6 +152,14 @@ def test_key_name_encoding_in_listing():
key_received = client.list_objects_v2(Bucket="foobar")["Contents"][0]["Key"]
key_received.should.equal(name)
name = "example/file.text"
client.put_object(Bucket="foobar", Key=name, Body=b"")
key_received = client.list_objects(
Bucket="foobar", Prefix="example/", Delimiter="/", MaxKeys=1, EncodingType="url"
)["Contents"][0]["Key"]
key_received.should.equal(name)
@mock_s3
def test_empty_key_set_on_existing_key():