mirror of
https://gitlab.com/comunic/comunicapiv3
synced 2024-11-29 16:56:28 +00:00
Fix invalid check
This commit is contained in:
parent
2f2ecdb444
commit
5e3ffcbeda
@ -28,7 +28,7 @@ use crate::routes::RequestResult;
|
|||||||
use crate::utils::mp3_utils::is_valid_mp3;
|
use crate::utils::mp3_utils::is_valid_mp3;
|
||||||
use crate::utils::mp4_utils::is_valid_mp4;
|
use crate::utils::mp4_utils::is_valid_mp4;
|
||||||
use crate::utils::pdf_utils::is_valid_pdf;
|
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::user_data_utils::{generate_new_user_data_file_name, prepare_file_creation, user_data_path};
|
||||||
use crate::utils::virtual_directories_utils;
|
use crate::utils::virtual_directories_utils;
|
||||||
use crate::utils::zip_utils::is_valid_zip;
|
use crate::utils::zip_utils::is_valid_zip;
|
||||||
@ -728,7 +728,7 @@ pub trait BaseRequestHandler {
|
|||||||
Ok(comment)
|
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<String> {
|
fn post_content(&mut self, name: &str, min_len: usize, required: bool) -> ResultBoxError<String> {
|
||||||
let content = self.post_string_opt(name, min_len, required)?;
|
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())?;
|
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))?;
|
self.forbidden(format!("The content inside {} was rejected!", name))?;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user