From 520637c245d461db8ee45ba466d763036b82ea42 Mon Sep 17 00:00:00 2001 From: Danny Hermes Date: Thu, 4 May 2017 10:48:50 -0700 Subject: [PATCH] Dropping internal usage of rewind in Blob.upload_from_string(). (#3365) --- storage/google/cloud/storage/blob.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/storage/google/cloud/storage/blob.py b/storage/google/cloud/storage/blob.py index 3bd9fe3edb0a..0b26781b06a4 100644 --- a/storage/google/cloud/storage/blob.py +++ b/storage/google/cloud/storage/blob.py @@ -919,10 +919,9 @@ def upload_from_string(self, data, content_type='text/plain', client=None): to the ``client`` stored on the blob's bucket. """ data = _to_bytes(data, encoding='utf-8') - string_buffer = BytesIO() - string_buffer.write(data) + string_buffer = BytesIO(data) self.upload_from_file( - file_obj=string_buffer, rewind=True, size=len(data), + file_obj=string_buffer, size=len(data), content_type=content_type, client=client) def create_resumable_upload_session(