Skip to content

Add support for mime from extension #663

@josefguenther

Description

@josefguenther

There was an issue for this before that was closed: #107. I agree with OP. The issue with the built in Golang mime package is that it uses underlying OS mime types which are often very limited (eg on serverless platforms, etc). So to support a wider array of mime types, you have to manually add each type with extension. Essentially, I have to go through this library and do something like this for each mime type:

mime.AddExtensionType(".png", "image/png")
... etc

Why can't we add a simple helper function to mimetype, since all the mime types with their extensions are already loaded? It could be as simple as adding the extension type to mime in newMIME() and using mime.TypeByExtension() in the helper.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions