fix errors
This commit is contained in:
parent
22b0298ff9
commit
7a57dc2034
@ -859,6 +859,9 @@ class S3Backend(BaseBackend):
|
||||
if str(key.version_id) != str(version_id)
|
||||
]
|
||||
)
|
||||
|
||||
if not bucket.keys.getlist(key_name):
|
||||
bucket.keys.pop(key_name)
|
||||
return True
|
||||
except KeyError:
|
||||
return False
|
||||
|
@ -24,7 +24,6 @@ from xml.dom import minidom
|
||||
|
||||
DEFAULT_REGION_NAME = 'us-east-1'
|
||||
|
||||
|
||||
def parse_key_name(pth):
|
||||
return pth.lstrip("/")
|
||||
|
||||
@ -706,8 +705,11 @@ class ResponseObject(_TemplateEnvironmentMixin):
|
||||
|
||||
if 'x-amz-copy-source' in request.headers:
|
||||
# Copy key
|
||||
src_key_parsed = urlparse(unquote(request.headers.get("x-amz-copy-source")))
|
||||
src_bucket, src_key = src_key_parsed.path.lstrip("/").split("/", 1)
|
||||
# you can have a quoted ?version=abc with a version Id, so work on
|
||||
# we need to parse the unquoted string first
|
||||
src_key_parsed = urlparse(request.headers.get("x-amz-copy-source"))
|
||||
src_bucket, src_key = unquote(src_key_parsed.path).\
|
||||
lstrip("/").split("/", 1)
|
||||
src_version_id = parse_qs(src_key_parsed.query).get(
|
||||
'versionId', [None])[0]
|
||||
self.backend.copy_key(src_bucket, src_key, bucket_name, key_name,
|
||||
|
Loading…
x
Reference in New Issue
Block a user