Still fix for max file upload size

parent b840a724
......@@ -73,7 +73,7 @@ class FileUploadHandler:
file.seek(0)
if not validate_file_size(file_size):
max_size_mb = current_app.config.get('MAX_CONTENT_LENGTH', 5 * 1024 * 1024 * 1024)
max_size_mb = current_app.config.get('MAX_CONTENT_LENGTH', 5 * 1024 * 1024 * 1024) // (1024 * 1024)
return False, f"File too large. Maximum size: {max_size_mb}MB"
return True, None
......
......@@ -297,7 +297,7 @@ def validate_file_size(file_size, max_size=None):
bool: True if file size is acceptable
"""
if max_size is None:
max_size = current_app.config.get('MAX_CONTENT_LENGTH', 500 * 1024 * 1024)
max_size = current_app.config.get('MAX_CONTENT_LENGTH', 5 * 1024 * 1024 * 1024)
return file_size <= max_size
......@@ -379,4 +379,4 @@ class SecurityHeaders:
"font-src 'self'; "
"connect-src 'self'"
)
return response
\ No newline at end of file
return response
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment