From: Phil Hagelberg Date: Sun, 1 Mar 2020 02:53:49 +0000 (-0800) Subject: Fix static FE plug to handle missing Accept header. X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=523f73dccd4e8f4028488e37f7333732db1eebd7;p=akkoma Fix static FE plug to handle missing Accept header. --- 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