Added exception to fuck errors, this should be handled by a web server if possible anyways.
This commit is contained in:
parent
3eb5ab67d2
commit
21b08a2501
11
run.py
11
run.py
|
@ -79,10 +79,13 @@ def upload_file():
|
||||||
|
|
||||||
# Only continue if a file that's allowed gets submitted.
|
# Only continue if a file that's allowed gets submitted.
|
||||||
if file and allowed_file(file.filename):
|
if file and allowed_file(file.filename):
|
||||||
if config["CHECK_FILESIZE"]:
|
try:
|
||||||
data = request.files["file"].read()
|
if config["CHECK_FILESIZE"]:
|
||||||
if len(data) >= config["MAX_FILESIZE"]:
|
data = request.files["file"].read()
|
||||||
return error_page("O-o-onii-chan, noo it's too big ~~"), 413
|
if len(data) >= config["MAX_FILESIZE"]:
|
||||||
|
return error_page("O-o-onii-chan, noo it's too big ~~"), 413
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
filename = secure_filename(file.filename)
|
filename = secure_filename(file.filename)
|
||||||
while os.path.exists(os.path.join(config["UPLOAD_FOLDER"], filename)):
|
while os.path.exists(os.path.join(config["UPLOAD_FOLDER"], filename)):
|
||||||
filename = str(randint(1000,8999)) + '-' + secure_filename(filename)
|
filename = str(randint(1000,8999)) + '-' + secure_filename(filename)
|
||||||
|
|
Loading…
Reference in New Issue