From 8879637616bc970ac7c13a030434d6c0e3e9f511 Mon Sep 17 00:00:00 2001 From: "Dominik V. Salonen" Date: Sat, 26 Dec 2015 21:23:35 +0100 Subject: [PATCH] Fuck me --- run.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/run.py b/run.py index 0fcd1ef..a91b663 100755 --- a/run.py +++ b/run.py @@ -79,13 +79,10 @@ def upload_file(): # Only continue if a file that's allowed gets submitted. if file and allowed_file(file.filename): - try: - if config["CHECK_FILESIZE"]: - data = request.files["file"].read() - if len(data) >= config["MAX_FILESIZE"]: - return error_page("O-o-onii-chan, noo it's too big ~~"), 413 - except Exception: - pass + if config["CHECK_FILESIZE"]: + fileContent = request.files["file"].read() + if len(fileContent) >= config["MAX_FILESIZE"]: + return error_page("O-o-onii-chan, noo it's too big ~~"), 413 filename = secure_filename(file.filename) while os.path.exists(os.path.join(config["UPLOAD_FOLDER"], filename)): filename = str(randint(1000,8999)) + '-' + secure_filename(filename)