From 59a11ee37bc2189ebab9fca932a990e276c0ed21 Mon Sep 17 00:00:00 2001 From: StNicolay Date: Thu, 20 Jul 2023 23:42:40 +0300 Subject: [PATCH] Added a 200 MB file size limit --- src/state/get_user.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/state/get_user.rs b/src/state/get_user.rs index a7e316e..9ec8405 100644 --- a/src/state/get_user.rs +++ b/src/state/get_user.rs @@ -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"),