Fix MAX_CONTENT_LENGTH configuration for large file uploads

- Explicitly set MAX_CONTENT_LENGTH in Flask app config during initialization
- Add logging to verify MAX_CONTENT_LENGTH is set correctly
- Fixes 'File too large' error for files over 500MB (now supports 5GB)
parent 7388278b
......@@ -265,6 +265,10 @@ class Config:
os.makedirs(Config.TEMP_UPLOAD_FOLDER, exist_ok=True)
logger.warning("Persistent directory utilities not available - using fallback directory creation")
# Set MAX_CONTENT_LENGTH explicitly in app config
app.config['MAX_CONTENT_LENGTH'] = Config.MAX_CONTENT_LENGTH
logger.info(f"Set MAX_CONTENT_LENGTH to {Config.MAX_CONTENT_LENGTH} bytes ({Config.MAX_CONTENT_LENGTH // (1024*1024)} MB)")
# Create other necessary directories
os.makedirs(os.path.dirname(Config.DAEMON_PID_FILE), exist_ok=True)
os.makedirs(os.path.dirname(Config.DAEMON_LOG_FILE), exist_ok=True)
......@@ -325,6 +329,7 @@ class ProductionConfig(Config):
logger.info(f"Using persistent directories - PyInstaller: {is_pyinstaller()}")
logger.info(f"Upload folder: {app.config.get('UPLOAD_FOLDER', cls.UPLOAD_FOLDER)}")
logger.info(f"Log file: {log_file}")
logger.info(f"MAX_CONTENT_LENGTH: {app.config.get('MAX_CONTENT_LENGTH', 'not set')}")
class TestingConfig(Config):
"""Testing configuration"""
......
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