Skip to content

Commit 9b55954

Browse files
handles mime
1 parent 6ed1f3b commit 9b55954

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

galleristazurestorage/__init__.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
from gallerist.abc import SyncFileStore
1+
from gallerist.abc import SyncFileStore, FileInfo
22
from azure.storage.common import CloudStorageAccount
3+
from azure.storage.blob import ContentSettings
34

45

56
class AzureBlobFileStore(SyncFileStore):
@@ -20,8 +21,11 @@ def read_file(self, file_path: str) -> bytes:
2021
blob = self.service.get_blob_to_bytes(self.container_name, file_path)
2122
return blob.content
2223

23-
def write_file(self, file_path: str, data: bytes):
24-
self.service.create_blob_from_bytes(self.container_name, file_path, data)
24+
def write_file(self, file_path: str, data: bytes, info: FileInfo):
25+
self.service.create_blob_from_bytes(self.container_name,
26+
file_path,
27+
data,
28+
content_settings=ContentSettings(content_type=info.mime))
2529

2630
def delete_file(self, file_path: str):
2731
self.service.delete_blob(self.container_name, file_path)

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ def readme():
77

88

99
setup(name='gallerist-azurestorage',
10-
version='0.0.2',
10+
version='0.0.3',
1111
description='Azure Storage file store for Gallerist',
1212
long_description=readme(),
1313
long_description_content_type='text/markdown',

0 commit comments

Comments
 (0)