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=bd80ff9a6c9f825aba9fadfc1fea6f05c3226590;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 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