Restrict attachments to only uploaded files only

This commit is contained in:
tusooa 2023-07-18 18:39:59 -04:00
commit ea4225a646
No known key found for this signature in database
GPG key ID: 42AEC43D48433C51
4 changed files with 17 additions and 4 deletions

View file

@ -59,7 +59,12 @@ defmodule Pleroma.Web.CommonAPI.Utils do
end
defp get_attachment(media_id) do
Repo.get(Object, media_id)
with %Object{data: data} = object <- Repo.get(Object, media_id),
%{"type" => type} when type in Pleroma.Constants.upload_object_types() <- data do
object
else
_ -> nil
end
end
@spec get_to_and_cc(ActivityDraft.t()) :: {list(String.t()), list(String.t())}