diff --git a/src/data/base_request_handler.rs b/src/data/base_request_handler.rs index 6469892..2f118a2 100644 --- a/src/data/base_request_handler.rs +++ b/src/data/base_request_handler.rs @@ -28,7 +28,7 @@ use crate::routes::RequestResult; use crate::utils::mp3_utils::is_valid_mp3; use crate::utils::mp4_utils::is_valid_mp4; use crate::utils::pdf_utils::is_valid_pdf; -use crate::utils::string_utils::{check_emoji_code, check_html_color, check_string_before_insert, check_url, remove_html_nodes}; +use crate::utils::string_utils::{check_emoji_code, check_html_color, check_url, remove_html_nodes}; use crate::utils::user_data_utils::{generate_new_user_data_file_name, prepare_file_creation, user_data_path}; use crate::utils::virtual_directories_utils; use crate::utils::zip_utils::is_valid_zip; @@ -728,7 +728,7 @@ pub trait BaseRequestHandler { Ok(comment) } - /// Get a content of a post and satinize it + /// Get a content of a post and sanitize it fn post_content(&mut self, name: &str, min_len: usize, required: bool) -> ResultBoxError { let content = self.post_string_opt(name, min_len, required)?; @@ -736,7 +736,7 @@ pub trait BaseRequestHandler { self.forbidden("Please do not include inline images!".to_string())?; } - if min_len > 0 && required && !check_string_before_insert(&content) { + if min_len > 0 && required && content.trim().len() < min_len { self.forbidden(format!("The content inside {} was rejected!", name))?; }