question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Configurable mime-types for upload-batch

See original GitHub issue

Is 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:open
  • Created 3 years ago
  • Reactions:1
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
devbeardcommented, May 26, 2020

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.

touch /etc/mime.types
cat ./my-mime-types | tee -a /etc/mime.types
az storage blob upload-batch --destination $STR_CONTAINER --source ./cdn --connection-string "$CDN_CSTR"

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:

font/ttf                     ttf
font/woff                    woff
font/woff2                   woff2
image/x-icon                 ico
text/javascript              js
application/xml              xml
application/octet-stream     map
0reactions
Juliehzlcommented, May 26, 2020

will consider the implementation when migrating track 2.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to configure the available MIME types for Files
Open the HCL Connections configuration XML file and edit the parameters. ATTENTION: Make sure you don't ... There, you can configure the new...
Read more >
az storage blob | Microsoft Learn
az storage blob upload-batch. Upload files from a local directory to a blob container. az storage blob url. Create the url to access...
Read more >
JSDoc: Source: upload/batch.js - Nuxeo
* using the batch upload API. *; * It creates and maintains a batch id from the Nuxeo Platform instance. * ...
Read more >
Configuration: Allowed MIME Types for Document Upload
You can use this configuration activity to define which documents are allowed to be uploaded by specifying the corresponding MIME types.
Read more >
Properly configuring server MIME types - MDN Web Docs
Versions of the Apache Web Server before 2.2.7 were configured to report a MIME type of text/plain or application/octet-stream for unknown ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found