scottwernervt / cloudstorage

Unified cloud storage API for storage services.
http://cloudstorage.readthedocs.io/en/latest/
MIT License
93 stars 27 forks source link

AzureStorageDriver reads stream twice without rewinding #44

Closed matt-carr closed 5 years ago

matt-carr commented 5 years ago

When using a stream (in my case, BytesIO) to upload a blob to Azure, file_checksum reads the file to create the md5 hash. Then, the stream is passed directly to the azure upload_blob function without a seek(0) to reset the cursor position. This results in an empty blob being stored.

Suggest checking in the file_checksum class if the filename object is seekable, and doing a seek(0) in that case