Added a 200 MB file size limit

This commit is contained in:
StNicolay 2023-07-20 23:42:40 +03:00
parent 63acd976e7
commit 59a11ee37b
Signed by: StNicolay
GPG Key ID: 9693D04DCD962B0D

View File

@ -17,6 +17,10 @@ fn validate_document(document: Option<&Document>) -> Result<&Document, &'static
None => return Err("You didn't send a file. Try again"),
};
if document.file.size > 1024 * 1024 * 200 {
return Err("The file is larger than 200 MiB. Try splitting it into multiple files");
}
let name = match document.file_name.as_deref() {
Some(name) => Path::new(name.trim_end()),
None => return Err("Couldn't get the name of the file. Try sending it again"),