Skip to content

Commit

Permalink
Merge pull request #122 from francescotimperi/devel-action
Browse files Browse the repository at this point in the history
fix: returns generic application/octet-stream if mimetype it isnot gu…
  • Loading branch information
francescotimperi authored Oct 14, 2023
2 parents 74e0d12 + 92efbc1 commit 7066e43
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 57 deletions.
9 changes: 2 additions & 7 deletions actions/common/minio_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,10 @@
from minio.commonconfig import CopySource

def extract_mimetype(file):

# python mymetype does does not support yet yaml files
if ".yaml" in file.lower() or ".yml" in file.lower():
mimetype = "application/yaml"
else:
mimetype, _ = mimetypes.guess_type(file)
mimetype, _ = mimetypes.guess_type(file)

if mimetype is None:
raise Exception(f"Failed to guess mimetype for {file}")
return "application/octet-stream"
else:
return mimetype

Expand Down
9 changes: 2 additions & 7 deletions actions/devel/download/common/minio_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,10 @@
from minio.commonconfig import CopySource

def extract_mimetype(file):

# python mymetype does does not support yet yaml files
if ".yaml" in file.lower() or ".yml" in file.lower():
mimetype = "application/yaml"
else:
mimetype, _ = mimetypes.guess_type(file)
mimetype, _ = mimetypes.guess_type(file)

if mimetype is None:
raise Exception(f"Failed to guess mimetype for {file}")
return "application/octet-stream"
else:
return mimetype

Expand Down
9 changes: 2 additions & 7 deletions actions/devel/ferretdb/common/minio_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,10 @@
from minio.commonconfig import CopySource

def extract_mimetype(file):

# python mymetype does does not support yet yaml files
if ".yaml" in file.lower() or ".yml" in file.lower():
mimetype = "application/yaml"
else:
mimetype, _ = mimetypes.guess_type(file)
mimetype, _ = mimetypes.guess_type(file)

if mimetype is None:
raise Exception(f"Failed to guess mimetype for {file}")
return "application/octet-stream"
else:
return mimetype

Expand Down
9 changes: 2 additions & 7 deletions actions/devel/minio/common/minio_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,10 @@
from minio.commonconfig import CopySource

def extract_mimetype(file):

# python mymetype does does not support yet yaml files
if ".yaml" in file.lower() or ".yml" in file.lower():
mimetype = "application/yaml"
else:
mimetype, _ = mimetypes.guess_type(file)
mimetype, _ = mimetypes.guess_type(file)

if mimetype is None:
raise Exception(f"Failed to guess mimetype for {file}")
return "application/octet-stream"
else:
return mimetype

Expand Down
9 changes: 2 additions & 7 deletions actions/devel/psql/common/minio_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,10 @@
from minio.commonconfig import CopySource

def extract_mimetype(file):

# python mymetype does does not support yet yaml files
if ".yaml" in file.lower() or ".yml" in file.lower():
mimetype = "application/yaml"
else:
mimetype, _ = mimetypes.guess_type(file)
mimetype, _ = mimetypes.guess_type(file)

if mimetype is None:
raise Exception(f"Failed to guess mimetype for {file}")
return "application/octet-stream"
else:
return mimetype

Expand Down
9 changes: 2 additions & 7 deletions actions/devel/redis/common/minio_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,10 @@
from minio.commonconfig import CopySource

def extract_mimetype(file):

# python mymetype does does not support yet yaml files
if ".yaml" in file.lower() or ".yml" in file.lower():
mimetype = "application/yaml"
else:
mimetype, _ = mimetypes.guess_type(file)
mimetype, _ = mimetypes.guess_type(file)

if mimetype is None:
raise Exception(f"Failed to guess mimetype for {file}")
return "application/octet-stream"
else:
return mimetype

Expand Down
9 changes: 2 additions & 7 deletions actions/devel/upload/common/minio_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,10 @@
from minio.commonconfig import CopySource

def extract_mimetype(file):

# python mymetype does does not support yet yaml files
if ".yaml" in file.lower() or ".yml" in file.lower():
mimetype = "application/yaml"
else:
mimetype, _ = mimetypes.guess_type(file)
mimetype, _ = mimetypes.guess_type(file)

if mimetype is None:
raise Exception(f"Failed to guess mimetype for {file}")
return "application/octet-stream"
else:
return mimetype

Expand Down
9 changes: 2 additions & 7 deletions actions/upload/common/minio_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,10 @@
from minio.commonconfig import CopySource

def extract_mimetype(file):

# python mymetype does does not support yet yaml files
if ".yaml" in file.lower() or ".yml" in file.lower():
mimetype = "application/yaml"
else:
mimetype, _ = mimetypes.guess_type(file)
mimetype, _ = mimetypes.guess_type(file)

if mimetype is None:
raise Exception(f"Failed to guess mimetype for {file}")
return "application/octet-stream"
else:
return mimetype

Expand Down
2 changes: 1 addition & 1 deletion olaris

0 comments on commit 7066e43

Please sign in to comment.