Merge branch 'tusooa/3154-attachment-type-check' into 'develop'

Restrict attachments to only uploaded files only

Closes #3154

See merge request pleroma/pleroma!3923
This commit is contained in:
Haelwenn 2023-08-03 10:01:32 +00:00
commit 819fccb7d1
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())}