Fix issues with unicode and slashes for S3. Closes #521.

This commit is contained in:
Steve Pulec 2016-05-01 22:03:52 -04:00
parent 15dc619fb2
commit 0a10b2f738
2 changed files with 13 additions and 1 deletions

View File

@ -15,5 +15,5 @@ url_paths = {
'{0}/(?P<key_or_bucket_name>[^/]+)/?$': S3ResponseInstance.ambiguous_response,
# path-based bucket + key
'{0}/(?P<bucket_name_path>[a-zA-Z0-9\-_./]+)/(?P<key_name>.+)': S3ResponseInstance.key_response,
'{0}/(?P<bucket_name_path>[^/]+)/(?P<key_name>.+)': S3ResponseInstance.key_response,
}

View File

@ -573,6 +573,18 @@ def test_key_with_special_characters():
keys[0].name.should.equal("test_list_keys_2/x?y")
@mock_s3
def test_unicode_key_with_slash():
conn = boto.connect_s3('the_key', 'the_secret')
bucket = conn.create_bucket("foobar")
key = Key(bucket)
key.key = "/the-key-unîcode/test"
key.set_contents_from_string("value")
key = bucket.get_key("/the-key-unîcode/test")
key.get_contents_as_string().should.equal(b'value')
@mock_s3
def test_bucket_key_listing_order():
conn = boto.connect_s3()