Don't assume webp accept is at the beginning

This commit is contained in:
Claudio Ortolina
2025-09-18 21:45:40 +03:00
parent 74a93e2ee0
commit 8807fce15b
@@ -48,9 +48,16 @@ defmodule MusicLibraryWeb.AssetController do
end
defp pick_format(conn) do
case get_req_header(conn, "accept") do
["image/webp" <> _] -> "image/webp"
_ -> "image/jpeg"
accept =
case get_req_header(conn, "accept") do
[] -> ""
[value] -> value
end
if String.contains?(accept, "image/webp") do
"image/webp"
else
"image/jpeg"
end
end