aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrinpatch <rinpatch@sdf.org>2020-03-13 18:46:54 +0000
committerrinpatch <rinpatch@sdf.org>2020-03-13 18:46:54 +0000
commit658f30c0b3cc5403d1172a07adba8bdcd79eb82c (patch)
tree6692112bf5b5e4cc1ac18a40c8984d22add38066
parent3e0f05f08e1aea082fbd0fcaf4a444fe15469b02 (diff)
parent523f73dccd4e8f4028488e37f7333732db1eebd7 (diff)
downloadpleroma-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.ex5
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