logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma git clone https://hacktivis.me/git/pleroma.git
commit: 155217979287999c69d9506f6fdb9697833e8fa0
parent 6b87dfad5de161cf2bef43d02ff89debcee84dd3
Author: Mark Felder <feld@feld.me>
Date:   Thu, 25 Feb 2021 10:07:29 -0600

Improved recursion through the api route list

Diffstat:

Mlib/pleroma/web/plugs/frontend_static.ex8+++-----
1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/lib/pleroma/web/plugs/frontend_static.ex b/lib/pleroma/web/plugs/frontend_static.ex @@ -55,11 +55,9 @@ defmodule Pleroma.Web.Plugs.FrontendStatic do defp invalid_path?([h | t], match), do: String.contains?(h, match) or invalid_path?(t) defp invalid_path?([], _match), do: false - defp api_route?(list) when is_list(list) and length(list) > 0 do - List.first(list) in @api_routes - end - - defp api_route?(_), do: false + defp api_route?([h | _]) when h in @api_routes, do: true + defp api_route?([_ | t]), do: api_route?(t) + defp api_route?([]), do: false defp call_static(conn, opts, from) do opts = Map.put(opts, :from, from)