Was causing more errors than it was worth

This commit is contained in:
Dominik V. Salonen 2015-12-26 21:44:47 +01:00
parent 8879637616
commit b2652beed6
2 changed files with 0 additions and 7 deletions

View File

@ -23,9 +23,6 @@ config["ALLOWED_EXTENSIONS"] = set(['txt', 'pdf', 'png', 'jpg', 'jpeg', 'gif'])
config["DELETE_FILES"] = True config["DELETE_FILES"] = True
config["TIME"] = 30 config["TIME"] = 30
config["CLEAN_INTERVAL"] = 120 config["CLEAN_INTERVAL"] = 120
# If possible, make your web server return a 413 instead of using this
config["CHECK_FILESIZE"] = True
config["MAX_FILESIZE"] = 1024 * 1024 * 100 # 100 MiB
# Site info displayed to the user # Site info displayed to the user
config["SITE_DATA"] = { config["SITE_DATA"] = {

4
run.py
View File

@ -79,10 +79,6 @@ 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"]:
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) 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)