Skip to content

Commit

Permalink
Quote the filename in the x-amz-copy-source header for multipart COPY…
Browse files Browse the repository at this point in the history
… operations. Fixes aws#614.
  • Loading branch information
garnaat authored and jamesls committed Mar 4, 2014
1 parent 3fd5b2a commit 15e7b06
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion awscli/customizations/s3/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

from botocore.vendored import requests
from botocore.exceptions import IncompleteReadError
from botocore.compat import quote

from awscli.customizations.s3.utils import find_bucket_key, MD5Error, \
operate, ReadFileChunk, relative_path, IORequest, IOCloseRequest
Expand Down Expand Up @@ -150,11 +151,13 @@ def __call__(self):
upload_id = self._upload_context.wait_for_upload_id()
bucket, key = find_bucket_key(self._filename.dest)
src_bucket, src_key = find_bucket_key(self._filename.src)
copy_source = '%s/%s' % (src_bucket, src_key)
copy_source = quote(copy_source.encode('utf-8'), safe='/~')
params = {'endpoint': self._filename.endpoint,
'bucket': bucket, 'key': key,
'part_number': self._part_number,
'upload_id': upload_id,
'copy_source': '%s/%s' % (src_bucket, src_key),
'copy_source': copy_source,
'copy_source_range': range_param}
response_data, http = operate(
self._filename.service, 'UploadPartCopy', params)
Expand Down

0 comments on commit 15e7b06

Please sign in to comment.