From bbbb064efb43572928c57277fb540bbbdf129d4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Tue, 24 Oct 2023 14:38:40 +0200 Subject: [PATCH] Add guards to media_type Closes #1180. --- lib/plug/conn/utils.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/plug/conn/utils.ex b/lib/plug/conn/utils.ex index 7c75477d..5bb7e20a 100644 --- a/lib/plug/conn/utils.ex +++ b/lib/plug/conn/utils.ex @@ -52,7 +52,7 @@ defmodule Plug.Conn.Utils do """ @spec media_type(binary) :: {:ok, type :: binary, subtype :: binary, params} | :error - def media_type(binary) do + def media_type(binary) when is_binary(binary) do case strip_spaces(binary) do "*/*" <> t -> mt_params(t, "*", "*") t -> mt_first(t, "")