Skip to content

Commit

Permalink
Merge pull request #58 from robertatakenaka/tk51
Browse files Browse the repository at this point in the history
INclui `content-type` ao subir arquivo para minio
  • Loading branch information
robertatakenaka committed Oct 25, 2021
2 parents 1d9b4fb + b6a9964 commit f8a32e8
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions dsm/extdeps/minio.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import os
import json
import hashlib
from mimetypes import guess_type

from minio import Minio
from minio.error import S3Error
Expand All @@ -12,6 +13,10 @@
logger = logging.getLogger(__name__)


def get_mimetype(file_path):
return guess_type(file_path)[0]


class SHA1Error(Exception):
pass

Expand Down Expand Up @@ -136,6 +141,7 @@ def register(self, file_path, prefix="", original_uri=None, preserve_name=False)
self.bucket_name,
object_name=object_name,
file_path=file_path,
content_type=get_mimetype(file_path),
)

except S3Error as err:
Expand Down

0 comments on commit f8a32e8

Please sign in to comment.