Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add underscore support for MIME types #1211

Conversation

luisgabrielroldan
Copy link
Contributor

This PR introduces support for underscore characters in MIME types, addressing an issue where valid MIME types containing underscores were incorrectly returning errors.

With this fix, MIME types that include underscore characters are correctly parsed and do not return an error. The behavior is now consistent with the IANA list of MIME types, which includes some types with underscores.

Current behaviour

Plug.Conn.Utils.media_type("application/media_control+xml")
:error

After the fix

Plug.Conn.Utils.media_type("application/media_control+xml")
{:ok, "application", "media_control+xml", %{}}

@josevalim josevalim merged commit b7e6753 into elixir-plug:main Mar 1, 2024
2 checks passed
@josevalim
Copy link
Member

💚 💙 💜 💛 ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants