Improved recursion through the api route list

This commit is contained in:
Mark Felder 2021-02-25 10:07:29 -06:00
parent 6b87dfad5d
commit 1552179792

View file

@ -55,11 +55,9 @@ defp invalid_path?([h | _], _match) when h in [".", "..", ""], do: true
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)