aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil Hagelberg <phil@hagelb.org>2020-02-29 18:53:49 -0800
committerrinpatch <rinpatch@sdf.org>2020-03-15 17:00:06 +0300
commitbd80ff9a6c9f825aba9fadfc1fea6f05c3226590 (patch)
tree7a5260ca1f0702576f6bfa04f1aa9347dbf4e8e8
parent5f9fbd7d336d2ffed6cd8f2640d9399f78ed7c2f (diff)
downloadpleroma-bd80ff9a6c9f825aba9fadfc1fea6f05c3226590.tar.gz
Fix static FE plug to handle missing Accept header.
-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