aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPhil Hagelberg <phil@hagelb.org>2020-02-29 18:53:49 -0800
committerPhil Hagelberg <phil@hagelb.org>2020-02-29 18:53:49 -0800
commit523f73dccd4e8f4028488e37f7333732db1eebd7 (patch)
tree1fba2191d82c4ff1fa527838aac4233d65a4eec9 /lib
parent438394d40447bdfb590ff206ad80907294da0e65 (diff)
downloadpleroma-523f73dccd4e8f4028488e37f7333732db1eebd7.tar.gz
Fix static FE plug to handle missing Accept header.
Diffstat (limited to 'lib')
-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 b3fb3c582..a8b22c243 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