diff options
author | rinpatch <rinpatch@sdf.org> | 2020-03-13 18:46:54 +0000 |
---|---|---|
committer | rinpatch <rinpatch@sdf.org> | 2020-03-13 18:46:54 +0000 |
commit | 658f30c0b3cc5403d1172a07adba8bdcd79eb82c (patch) | |
tree | 6692112bf5b5e4cc1ac18a40c8984d22add38066 | |
parent | 3e0f05f08e1aea082fbd0fcaf4a444fe15469b02 (diff) | |
parent | 523f73dccd4e8f4028488e37f7333732db1eebd7 (diff) | |
download | pleroma-658f30c0b3cc5403d1172a07adba8bdcd79eb82c.tar.gz |
Merge branch 'static-accept-missing' into 'develop'
Fix static FE plug to handle missing Accept header.
See merge request pleroma/pleroma!2260
-rw-r--r-- | lib/pleroma/plugs/static_fe_plug.ex | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/pleroma/plugs/static_fe_plug.ex b/lib/pleroma/plugs/static_fe_plug.ex index deebe4879..156e6788e 100644 --- a/lib/pleroma/plugs/static_fe_plug.ex +++ b/lib/pleroma/plugs/static_fe_plug.ex @@ -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 |