X-Git-Url: http://these/git/?a=blobdiff_plain;f=crates%2Fapi_crud%2Fsrc%2Fcustom_emoji%2Fcreate.rs;h=93e7114aef2cd875a3c0ab7a0ea75fc8aeb4045b;hb=3471f3533cb724b2cf6953d563aadfcc9f66c1d2;hp=dcf4fe7f9321101e24b74c185e8df89317c73ab6;hpb=2de994797e4fe8f569c903de35da55ccdf823fb8;p=lemmy.git diff --git a/crates/api_crud/src/custom_emoji/create.rs b/crates/api_crud/src/custom_emoji/create.rs index dcf4fe7f..93e7114a 100644 --- a/crates/api_crud/src/custom_emoji/create.rs +++ b/crates/api_crud/src/custom_emoji/create.rs @@ -3,7 +3,7 @@ use actix_web::web::Data; use lemmy_api_common::{ context::LemmyContext, custom_emoji::{CreateCustomEmoji, CustomEmojiResponse}, - utils::{is_admin, local_user_view_from_jwt}, + utils::{is_admin, local_user_view_from_jwt, sanitize_html}, }; use lemmy_db_schema::source::{ custom_emoji::{CustomEmoji, CustomEmojiInsertForm}, @@ -26,11 +26,15 @@ impl PerformCrud for CreateCustomEmoji { // Make sure user is an admin is_admin(&local_user_view)?; + let shortcode = sanitize_html(data.shortcode.to_lowercase().trim()); + let alt_text = sanitize_html(&data.alt_text); + let category = sanitize_html(&data.category); + let emoji_form = CustomEmojiInsertForm::builder() .local_site_id(local_site.id) - .shortcode(data.shortcode.to_lowercase().trim().to_string()) - .alt_text(data.alt_text.to_string()) - .category(data.category.to_string()) + .shortcode(shortcode) + .alt_text(alt_text) + .category(category) .image_url(data.clone().image_url.into()) .build(); let emoji = CustomEmoji::create(&mut context.pool(), &emoji_form).await?;