Allow emojis with image/gif media type
This commit is contained in:
parent
6d6a41d3e5
commit
441264f34c
2 changed files with 12 additions and 4 deletions
|
@ -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;
|
||||
},
|
||||
};
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue