Seek to the beginning of a file stream before calculating the hash, as it was likely read forward during upload.
@@ -647,6 +647,8 @@ class StorageDriver(BaseDriver):
total_len = 0
if hasattr(stream, '__next__') or hasattr(stream, 'next'):
+ if hasattr(stream, 'seek'):
+ stream.seek(0)
for chunk in libcloud.utils.files.read_in_chunks(iterator=stream):
hasher.update(b(chunk))
total_len += len(chunk)
