Skip to content

Commit

Permalink
Merge pull request #121 from francescotimperi/devel-action
Browse files Browse the repository at this point in the history
fix: upload action assign application/yaml mimetype to .yaml and .yml
  • Loading branch information
francescotimperi committed Oct 14, 2023
2 parents a8e881f + 4e98ada commit 74e0d12
Show file tree
Hide file tree
Showing 11 changed files with 64 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ clusters/worker.yaml
*.kubeconfig
run.pid
*.off
actions/*/nuvolaris/
actions/**/nuvolaris/
!actions/**/__main__.py
_*.yaml
apihost.txt
Expand Down
4 changes: 4 additions & 0 deletions actions/Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,10 @@ tasks:
- >
curl -X PUT -T ../nuvolaris/templates/content.html -H "minioauth: zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG" {{.APIHOST}}/api/v1/web/whisk-system/nuv/upload/nuvolaris/tidy/content.html
upload:yaml:
- >
curl -X PUT -T ../nuvolaris/templates/couchdb-init.yaml -H "minioauth: zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG" {{.APIHOST}}/api/v1/web/whisk-system/nuv/upload/nuvolaris/yaml/couchdb-init.yaml
upload:chess:
- >
curl -X PUT -T ../nuvolaris/templates/content.html -H "minioauth: zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG" {{.APIHOST}}/api/v1/web/whisk-system/nuv/upload/nuvolaris/chess/index.html
Expand Down
8 changes: 7 additions & 1 deletion actions/common/minio_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,13 @@
from minio.commonconfig import CopySource

def extract_mimetype(file):
mimetype, _ = mimetypes.guess_type(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)

if mimetype is None:
raise Exception(f"Failed to guess mimetype for {file}")
else:
Expand Down
8 changes: 7 additions & 1 deletion actions/devel/download/common/minio_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,13 @@
from minio.commonconfig import CopySource

def extract_mimetype(file):
mimetype, _ = mimetypes.guess_type(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)

if mimetype is None:
raise Exception(f"Failed to guess mimetype for {file}")
else:
Expand Down
8 changes: 7 additions & 1 deletion actions/devel/ferretdb/common/minio_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,13 @@
from minio.commonconfig import CopySource

def extract_mimetype(file):
mimetype, _ = mimetypes.guess_type(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)

if mimetype is None:
raise Exception(f"Failed to guess mimetype for {file}")
else:
Expand Down
8 changes: 7 additions & 1 deletion actions/devel/minio/common/minio_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,13 @@
from minio.commonconfig import CopySource

def extract_mimetype(file):
mimetype, _ = mimetypes.guess_type(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)

if mimetype is None:
raise Exception(f"Failed to guess mimetype for {file}")
else:
Expand Down
10 changes: 8 additions & 2 deletions actions/devel/psql/common/minio_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,13 @@
from minio.commonconfig import CopySource

def extract_mimetype(file):
mimetype, _ = mimetypes.guess_type(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)

if mimetype is None:
raise Exception(f"Failed to guess mimetype for {file}")
else:
Expand Down Expand Up @@ -177,5 +183,5 @@ def mv_file(mo_client, orig_bucket, orig_file, dest_bucket, dest_file):
except Exception as e:
print(e)
return None
return None
return None

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

def extract_mimetype(file):
mimetype, _ = mimetypes.guess_type(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)

if mimetype is None:
raise Exception(f"Failed to guess mimetype for {file}")
else:
Expand Down Expand Up @@ -177,5 +183,5 @@ def mv_file(mo_client, orig_bucket, orig_file, dest_bucket, dest_file):
except Exception as e:
print(e)
return None
return None
return None

8 changes: 7 additions & 1 deletion actions/devel/upload/common/minio_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,13 @@
from minio.commonconfig import CopySource

def extract_mimetype(file):
mimetype, _ = mimetypes.guess_type(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)

if mimetype is None:
raise Exception(f"Failed to guess mimetype for {file}")
else:
Expand Down
8 changes: 7 additions & 1 deletion actions/upload/common/minio_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,13 @@
from minio.commonconfig import CopySource

def extract_mimetype(file):
mimetype, _ = mimetypes.guess_type(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)

if mimetype is None:
raise Exception(f"Failed to guess mimetype for {file}")
else:
Expand Down

0 comments on commit 74e0d12

Please sign in to comment.