diff --git a/src/activitypub/handlers/create.rs b/src/activitypub/handlers/create.rs index 77bb8a8..a9ed5ed 100644 --- a/src/activitypub/handlers/create.rs +++ b/src/activitypub/handlers/create.rs @@ -38,7 +38,7 @@ use crate::models::posts::{ ATTACHMENTS_MAX_NUM, CONTENT_MAX_SIZE, EMOJI_MAX_SIZE, - EMOJI_MEDIA_TYPE, + EMOJI_MEDIA_TYPES, EMOJIS_MAX_NUM, }, }; @@ -415,9 +415,14 @@ pub async fn handle_note( }, }; let media_type = match maybe_media_type.as_deref() { - Some(media_type @ EMOJI_MEDIA_TYPE) => media_type, + Some(media_type) if EMOJI_MEDIA_TYPES.contains(&media_type) => { + media_type + }, _ => { - log::warn!("unexpected emoji media type: {:?}", maybe_media_type); + log::warn!( + "unexpected emoji media type: {:?}", + maybe_media_type, + ); continue; }, }; diff --git a/src/models/posts/validators.rs b/src/models/posts/validators.rs index 58a3fb4..bae6f78 100644 --- a/src/models/posts/validators.rs +++ b/src/models/posts/validators.rs @@ -3,7 +3,10 @@ use crate::utils::html::clean_html_strict; pub const ATTACHMENTS_MAX_NUM: usize = 15; pub const EMOJI_MAX_SIZE: u64 = 250 * 1000; // 250 kB -pub const EMOJI_MEDIA_TYPE: &str = "image/png"; +pub const EMOJI_MEDIA_TYPES: [&str; 2] = [ + "image/gif", + "image/png", +]; pub const EMOJIS_MAX_NUM: usize = 20; pub const CONTENT_MAX_SIZE: usize = 100000;