[MIG] attachment_minio: odoo 13, additionally include mime-type per GITHUB#12

This commit is contained in:
Jared Kipe
2020-07-01 15:29:21 -07:00
parent 55b59d9642
commit 9e8e287e75
3 changed files with 12 additions and 2 deletions

View File

@@ -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)