Skip to content

Commit

Permalink
Remove etag verification on uploads, not needed anymore
Browse files Browse the repository at this point in the history
This has been pushed down to the botocore layer so other
projects such as boto3 can leverage this logic.
  • Loading branch information
jamesls committed Jun 19, 2015
1 parent 777faeb commit 5f5e480
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 19 deletions.
7 changes: 2 additions & 5 deletions awscli/customizations/s3/fileinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

from botocore.compat import quote
from awscli.customizations.s3.utils import find_bucket_key, \
check_etag, uni_print, guess_content_type, MD5Error, bytes_print
uni_print, guess_content_type, MD5Error, bytes_print


class CreateDirectoryError(Exception):
Expand Down Expand Up @@ -48,7 +48,7 @@ def save_file(filename, response_data, last_update, is_stream=False):
file_chunks = iter(partial(body.read, 1024 * 1024), b'')
if is_stream:
# Need to save the data to be able to check the etag for a stream
# becuase once the data is written to the stream there is no
# because once the data is written to the stream there is no
# undoing it.
payload = write_to_file(None, etag, md5, file_chunks, True)
else:
Expand Down Expand Up @@ -263,9 +263,6 @@ def _handle_upload(self, body):
}
self._handle_object_params(params)
response_data = self.client.put_object(**params)
etag = response_data['ETag'][1:-1]
body.seek(0)
check_etag(etag, body)

def _inject_content_type(self, params, filename):
# Add a content type param if we can guess the type.
Expand Down
14 changes: 0 additions & 14 deletions awscli/customizations/s3/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,20 +251,6 @@ def find_dest_path_comp_key(files, src_path=None):
return dest_path, compare_key


def check_etag(etag, fileobj):
"""
This fucntion checks the etag and the md5 checksum to ensure no
data was corrupted upon transfer.
"""
get_chunk = partial(fileobj.read, 1024 * 1024)
m = hashlib.md5()
for chunk in iter(get_chunk, b''):
m.update(chunk)
if '-' not in etag:
if etag != m.hexdigest():
raise MD5Error


def create_warning(path, error_message):
"""
This creates a ``PrintTask`` for whenever a warning is to be thrown.
Expand Down

0 comments on commit 5f5e480

Please sign in to comment.