From fcb2542410ca544691d8fc3c023e54026b4c33f4 Mon Sep 17 00:00:00 2001 From: Eric Lang Date: Tue, 7 Jan 2014 12:59:10 -0800 Subject: [PATCH] Special characters now allowed in s3bucket_path keys. Fixes issue #78. --- moto/s3bucket_path/urls.py | 2 +- tests/test_s3bucket_path/test_s3bucket_path.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/moto/s3bucket_path/urls.py b/moto/s3bucket_path/urls.py index 28f1debc..3d9d09ce 100644 --- a/moto/s3bucket_path/urls.py +++ b/moto/s3bucket_path/urls.py @@ -16,5 +16,5 @@ url_paths = { '{0}/$': bucket_response3, '{0}/(?P[a-zA-Z0-9\-_.]+)$': ro.bucket_response, '{0}/(?P[a-zA-Z0-9\-_.]+)/$': bucket_response2, - '{0}/(?P[a-zA-Z0-9\-_./]+)/(?P[a-zA-Z0-9\-_.?]+)': ro.key_response + '{0}/(?P[a-zA-Z0-9\-_./]+)/(?P.+)': ro.key_response } diff --git a/tests/test_s3bucket_path/test_s3bucket_path.py b/tests/test_s3bucket_path/test_s3bucket_path.py index 1f62f23e..5501aea3 100644 --- a/tests/test_s3bucket_path/test_s3bucket_path.py +++ b/tests/test_s3bucket_path/test_s3bucket_path.py @@ -231,12 +231,12 @@ def test_key_with_special_characters(): conn = create_connection() bucket = conn.create_bucket('test_bucket_name') - key = Key(bucket, 'test_list_keys_2/x?y') + key = Key(bucket, 'test_list_keys_2/*x+?^@~!y') key.set_contents_from_string('value1') key_list = bucket.list('test_list_keys_2/', '/') keys = [x for x in key_list] - keys[0].name.should.equal("test_list_keys_2/x?y") + keys[0].name.should.equal("test_list_keys_2/*x+?^@~!y") @mock_s3bucket_path