Prevent AP collection page number being < 1

Closes #1184

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2022-11-21 16:56:20 +01:00
parent 7a4ff475d5
commit 3e15048843
2 changed files with 29 additions and 0 deletions

View File

@@ -191,6 +191,7 @@ defmodule Mobilizon.Web.ActivityPubController do
defp actor_collection(conn, collection, %{"name" => name, "page" => page}) do
with {page, ""} <- Integer.parse(page),
page <- max(page, 1),
%Actor{} = actor <- Actors.get_local_actor_by_name_with_preload(name) do
conn
|> put_resp_header("content-type", "application/activity+json")