Ignore emojis with non-unique names in remote posts

This commit is contained in:
silverpill 2023-03-14 18:48:36 +00:00
parent a3a4579e03
commit 8b8f1bb678
2 changed files with 10 additions and 2 deletions

View file

@ -28,6 +28,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Fixed
- Allow `!` after hashtags and mentions.
- Ignore emojis with non-unique names in remote posts.
## [1.16.0] - 2023-03-08

View file

@ -304,14 +304,21 @@ pub async fn handle_emoji(
} else {
let hostname = get_hostname(&tag.id)
.map_err(|_| ValidationError("invalid emoji ID"))?;
create_emoji(
match create_emoji(
db_client,
emoji_name,
Some(&hostname),
image,
Some(&tag.id),
&tag.updated,
).await?
).await {
Ok(emoji) => emoji,
Err(DatabaseError::AlreadyExists(_)) => {
log::warn!("emoji name is not unique: {}", emoji_name);
return Ok(None);
},
Err(other_error) => return Err(other_error.into()),
}
};
Ok(Some(emoji))
}