Fix static FE plug to handle missing Accept header.

This commit is contained in:
Phil Hagelberg 2020-02-29 18:53:49 -08:00
parent 438394d404
commit 523f73dccd

View File

@ -21,6 +21,9 @@ def call(conn, _) do
defp enabled?, do: Pleroma.Config.get([:static_fe, :enabled], false)
defp accepts_html?(conn) do
conn |> get_req_header("accept") |> List.first() |> String.contains?("text/html")
case get_req_header(conn, "accept") do
[accept | _] -> String.contains?(accept, "text/html")
_ -> false
end
end
end