From d96769a91c6f848c40ecc6d627bf77f97d58c345 Mon Sep 17 00:00:00 2001 From: Steve Pulec Date: Sat, 13 Apr 2013 17:28:00 -0400 Subject: [PATCH] Fix for buckets with periods in them. Closes #15. --- moto/s3/urls.py | 4 ++-- tests/test_s3/test_s3.py | 9 +++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/moto/s3/urls.py b/moto/s3/urls.py index 662a717b0..21370c15a 100644 --- a/moto/s3/urls.py +++ b/moto/s3/urls.py @@ -1,10 +1,10 @@ from .responses import bucket_response, key_response url_bases = [ - "https?://(?P[a-zA-Z0-9\-_]*)\.?s3.amazonaws.com" + "https?://(?P[a-zA-Z0-9\-_.]*)\.?s3.amazonaws.com" ] url_paths = { '{0}/$': bucket_response, - '{0}/(?P[a-zA-Z0-9\-_]+)': key_response, + '{0}/(?P[a-zA-Z0-9\-_.]+)': key_response, } diff --git a/tests/test_s3/test_s3.py b/tests/test_s3/test_s3.py index 1c8c4c8a8..d4ac1170b 100644 --- a/tests/test_s3/test_s3.py +++ b/tests/test_s3/test_s3.py @@ -196,3 +196,12 @@ def test_bucket_method_not_implemented(): @mock_s3 def test_key_method_not_implemented(): requests.post.when.called_with("https://foobar.s3.amazonaws.com/foo").should.throw(NotImplementedError) + + +@mock_s3 +def test_bucket_name_with_dot(): + conn = boto.connect_s3() + bucket = conn.create_bucket('firstname.lastname') + + k = Key(bucket, 'somekey') + k.set_contents_from_string('somedata')