From a7938ed9ec814fa9cf53272ceb65e84d11d50dc1 Mon Sep 17 00:00:00 2001 From: Steve Pulec Date: Sun, 24 Jan 2016 16:33:36 -0500 Subject: [PATCH] Fix s3 url regex to ensure path-based bucket and key does not catch. --- moto/s3/urls.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/moto/s3/urls.py b/moto/s3/urls.py index 6d9ff514e..9e6dba10a 100644 --- a/moto/s3/urls.py +++ b/moto/s3/urls.py @@ -1,6 +1,5 @@ from __future__ import unicode_literals -from moto.compat import OrderedDict from .responses import S3ResponseInstance url_bases = [ @@ -8,13 +7,13 @@ url_bases = [ "https?://(?P[a-zA-Z0-9\-_.]*)\.?s3(.*).amazonaws.com" ] -url_paths = OrderedDict([ +url_paths = { # subdomain bucket - ('{0}/$', S3ResponseInstance.bucket_response), + '{0}/$': S3ResponseInstance.bucket_response, # subdomain key of path-based bucket - ('{0}/(?P.+)', S3ResponseInstance.ambiguous_response), + '{0}/(?P[^/]+)/?$': S3ResponseInstance.ambiguous_response, # path-based bucket + key - ('{0}/(?P[a-zA-Z0-9\-_./]+)/(?P.+)', S3ResponseInstance.key_response), -]) + '{0}/(?P[a-zA-Z0-9\-_./]+)/(?P.+)': S3ResponseInstance.key_response, +}