Added a 200 MB file size limit
This commit is contained in:
		@@ -17,6 +17,10 @@ fn validate_document(document: Option<&Document>) -> Result<&Document, &'static
 | 
				
			|||||||
        None => return Err("You didn't send a file. Try again"),
 | 
					        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() {
 | 
					    let name = match document.file_name.as_deref() {
 | 
				
			||||||
        Some(name) => Path::new(name.trim_end()),
 | 
					        Some(name) => Path::new(name.trim_end()),
 | 
				
			||||||
        None => return Err("Couldn't get the name of the file. Try sending it again"),
 | 
					        None => return Err("Couldn't get the name of the file. Try sending it again"),
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user