Configurable mime-types for upload-batch
See original GitHub issueIs your feature request related to a problem? Please describe.
When using a storage account as a static file host and uploading a large set of files, it is really annoying when the content type is guessed wrong. Especially since these metadata seems impossible to update via az
.
Example: woff2 file should (since 2017) have content type font/woff2
, but is uploaded as application/octet-stream
when using az storage blob upload-batch
.
Describe the solution you’d like
The ability to provide the path to a custom mime-types file (hopefully with the same syntax as other mime.types files) or clear instructions (across OS) on how to configure . Especially how to configure the Docker image mcr.microsoft.com/azure-cli
to work with custom mime-types.
Example: az storage blob upload-batch --source ./folder --destination static --connection-string <cstr> --mime-types ./my-mime-types.conf
Describe alternatives you’ve considered
Beyond programming my own bulk uploader, I don’t have any suggestions for workarounds.
Additional context
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:6 (3 by maintainers)
If someone else comes across this thread, I managed to sort of get it working, but I don’t think it is a perfect workaround, and I hope MSFT continues with a solution on their end as well @Juliehzl .
Workaround: By leveraging that I am root in my container that I deploy to the storage account from (build pipeline), I change the mimetypes in the system on the fly. I have a mimetype file in my CDN repository that I utilize to version control the mapping.
AzCli (and the mimetype python module, whos defaults are a bit dated) seems to have code for user folder lookup of a mimetype file, but I could only get the system replacement working. See these lines: https://github.com/python/cpython/blob/master/Lib/mimetypes.py#L42-L52
Example contents of my repo mimetype file:
will consider the implementation when migrating track 2.