diff --git a/src/activitypub/activity.rs b/src/activitypub/activity.rs index 967b9a3..01770fd 100644 --- a/src/activitypub/activity.rs +++ b/src/activitypub/activity.rs @@ -7,11 +7,10 @@ use super::vocabulary::HASHTAG; #[derive(Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct Attachment { - pub name: Option, - #[serde(rename = "type")] pub attachment_type: String, + pub name: Option, pub media_type: Option, pub url: Option, } diff --git a/src/activitypub/handlers/create.rs b/src/activitypub/handlers/create.rs index 6c53b2f..d58697f 100644 --- a/src/activitypub/handlers/create.rs +++ b/src/activitypub/handlers/create.rs @@ -162,14 +162,15 @@ pub async fn handle_note( .map_err(|_| ValidationError("invalid attachment property"))?; let mut downloaded = vec![]; for attachment in list { - if attachment.attachment_type != DOCUMENT && - attachment.attachment_type != IMAGE - { - log::warn!( - "skipping attachment of type {}", - attachment.attachment_type, - ); - continue; + match attachment.attachment_type.as_str() { + DOCUMENT | IMAGE | VIDEO => (), + _ => { + log::warn!( + "skipping attachment of type {}", + attachment.attachment_type, + ); + continue; + }, }; let attachment_url = attachment.url .ok_or(ValidationError("attachment URL is missing"))?;