From 5e3ffcbeda78083bc21f8739318b2870d2222123 Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Fri, 16 Apr 2021 07:58:45 +0200 Subject: [PATCH] Fix invalid check --- src/data/base_request_handler.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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))?; }