diff --git a/attachment_minio/README.md b/attachment_minio/README.md index 1e32a8e0..3a81269c 100644 --- a/attachment_minio/README.md +++ b/attachment_minio/README.md @@ -50,3 +50,11 @@ env.cr.commit() If `attachment_minio` is not already installed, you can then install it and the migration should be noted in the logs. **Ensure that the timeouts are long enough that the migration can finish.** + +### Base Setup + +This module utilizes `base_attachment_object_storage` + +The System Parameter `ir_attachment.storage.force.database` can be customized to +force storage of files in the database. See the documentation of the module +`base_attachment_object_storage`. diff --git a/attachment_minio/__manifest__.py b/attachment_minio/__manifest__.py index 973a8b1d..fe230ae8 100755 --- a/attachment_minio/__manifest__.py +++ b/attachment_minio/__manifest__.py @@ -1,6 +1,6 @@ { "name": "Attachment MinIO", - "version": "12.0.1.0.0", + "version": "13.0.1.0.0", "depends": [ "base_attachment_object_storage", ], diff --git a/attachment_minio/models/ir_attachment.py b/attachment_minio/models/ir_attachment.py index 7a50ad16..70ba2640 100644 --- a/attachment_minio/models/ir_attachment.py +++ b/attachment_minio/models/ir_attachment.py @@ -85,7 +85,9 @@ class MinioAttachment(models.Model): client = self._get_minio_client() bucket = self._get_minio_bucket(client) minio_key = self._get_minio_key(key) - client.put_object(bucket, minio_key, io.BytesIO(bin_data), len(bin_data)) + with io.BytesIO(bin_data) as bin_data_io: + client.put_object(bucket, minio_key, bin_data_io, len(bin_data), + content_type=self.mimetype) return self._get_minio_fname(bucket, minio_key) return super(MinioAttachment, self)._store_file_write(key, bin_data)