Merge pull request '2022.09 stable' (#208) from develop into stable
[akkoma] / lib / pleroma / web / activity_pub / object_validators / attachment_validator.ex
index ffdb16976f30263fc71b7f7dea9592eff4d5b4e3..dba18a3d0b2baf2000f043c3a6773b8e465f3d40 100644 (file)
@@ -11,6 +11,7 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.AttachmentValidator do
 
   @primary_key false
   embedded_schema do
+    field(:id, :string)
     field(:type, :string)
     field(:mediaType, :string, default: "application/octet-stream")
     field(:name, :string)
@@ -43,7 +44,7 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.AttachmentValidator do
       |> fix_url()
 
     struct
-    |> cast(data, [:type, :mediaType, :name, :blurhash])
+    |> cast(data, [:id, :type, :mediaType, :name, :blurhash])
     |> cast_embed(:url, with: &url_changeset/2, required: true)
     |> validate_inclusion(:type, ~w[Link Document Audio Image Video])
     |> validate_required([:type, :mediaType])