Pagination: Don't be dos'd by random parameters.

This commit is contained in:
lain 2021-01-12 12:59:50 +01:00
parent e1a547d7d3
commit 7a1cb752dd

View file

@ -67,7 +67,7 @@ def add_link_headers(conn, entries, extra_params) do
defp build_pagination_fields(conn, min_id, max_id, extra_params) do defp build_pagination_fields(conn, min_id, max_id, extra_params) do
params = params =
conn.params conn.params
|> Map.drop(Map.keys(conn.path_params) |> Enum.map(&String.to_atom/1)) |> Map.drop(Map.keys(conn.path_params) |> Enum.map(&String.to_existing_atom/1))
|> Map.merge(extra_params) |> Map.merge(extra_params)
|> Map.drop(@id_keys) |> Map.drop(@id_keys)