diff --git a/moto/s3/urls.py b/moto/s3/urls.py index 9e6dba10a..1f0677956 100644 --- a/moto/s3/urls.py +++ b/moto/s3/urls.py @@ -15,5 +15,5 @@ url_paths = { '{0}/(?P[^/]+)/?$': S3ResponseInstance.ambiguous_response, # path-based bucket + key - '{0}/(?P[a-zA-Z0-9\-_./]+)/(?P.+)': S3ResponseInstance.key_response, + '{0}/(?P[^/]+)/(?P.+)': S3ResponseInstance.key_response, } diff --git a/tests/test_s3/test_s3.py b/tests/test_s3/test_s3.py index 28aae08a4..f37096bb1 100644 --- a/tests/test_s3/test_s3.py +++ b/tests/test_s3/test_s3.py @@ -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()