From b7e6753512c1d923ed8061c4de37f1f0ec849bd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Rold=C3=A1n?= Date: Fri, 1 Mar 2024 18:52:27 -0300 Subject: [PATCH] Add underscore support for MIME types (#1211) --- lib/plug/conn/utils.ex | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/plug/conn/utils.ex b/lib/plug/conn/utils.ex index 5bb7e20a..e2652477 100644 --- a/lib/plug/conn/utils.ex +++ b/lib/plug/conn/utils.ex @@ -8,7 +8,7 @@ defmodule Plug.Conn.Utils do @upper ?A..?Z @lower ?a..?z @alpha ?0..?9 - @other [?., ?-, ?+] + @other [?., ?-, ?+, ?_] @space [?\s, ?\t] @specials ~c|()<>@,;:\\"/[]?={}| @@ -32,6 +32,9 @@ defmodule Plug.Conn.Utils do iex> media_type "APPLICATION/vnd.ms-data+XML" {:ok, "application", "vnd.ms-data+xml", %{}} + iex> media_type "application/media_control+xml" + {:ok, "application", "media_control+xml", %{}} + iex> media_type "text/*; q=1.0" {:ok, "text", "*", %{"q" => "1.0"}}