jowilf / sqlalchemy-file

SQLAlchemy-file is a SQLAlchemy extension for attaching files to SQLAlchemy model and uploading them to various storage such as Local Storage, Amazon S3, Rackspace CloudFiles, Google Storage and others using Apache Libcloud.
https://jowilf.github.io/sqlalchemy-file/
MIT License
95 stars 12 forks source link

Thumbnail is stored as "application/octet-stream" #78

Closed wojtha closed 1 year ago

wojtha commented 1 year ago

I've enabled the thumbnail processor, unfortunately the thumbnail is uploaded as "application/octet-stream" when uploading to the Google Storage bucket so it can't be served from the bucket.

Version: sqlalchemy_file-0.4.0 Storage driver: GoogleStorageDriver

I did a step debugging of the extra data coming to StorageManager.save_file

Original file extra:

{'content_type': 'image/png', 'meta_data': {'filename': 'Screenshot 2023-05-26 145006.png', 'content_type': 'image/png'}}

Thumbnail file extra:

{'meta_data': {'filename': 'Screenshot 2023-05-26 145006.png.thumbnail116x128.png', 'content_type': 'image/png', 'width': 116, 'height': 128}}

So apparently it is caused by the missing 'content_type': 'image/png' in the thumbnail extra data.