1
0
mirror of https://git.pleroma.social/sjw/pleroma.git synced 2024-12-27 02:55:48 +01:00

Merge branch 'static-accept-missing' into 'develop'

Fix static FE plug to handle missing Accept header.

See merge request pleroma/pleroma!2260
This commit is contained in:
rinpatch 2020-03-13 18:46:54 +00:00
commit 658f30c0b3

View File

@ -21,6 +21,9 @@ defmodule Pleroma.Plugs.StaticFEPlug 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