Skip to content

refactor: centralize file size error message in upload_config (#635)#993

Open
Pranjalverma0720 wants to merge 1 commit into
imDarshanGK:mainfrom
Pranjalverma0720:feat/635-file-size-limit
Open

refactor: centralize file size error message in upload_config (#635)#993
Pranjalverma0720 wants to merge 1 commit into
imDarshanGK:mainfrom
Pranjalverma0720:feat/635-file-size-limit

Conversation

@Pranjalverma0720

Copy link
Copy Markdown

Description

This PR addresses issue #635 by refactoring the file size validation error handling. Instead of relying on a hardcoded string inside the upload router, it now utilizes the centralized UPLOAD_ERROR_MESSAGES dictionary located in the configuration file.

Changes Made

  • backend/app/utils/upload_config.py: Added a dedicated "file_too_large" key-value pair to the UPLOAD_ERROR_MESSAGES dictionary to explicitly communicate the 5MB size restriction.
  • backend/app/routers/upload_file.py: Imported UPLOAD_ERROR_MESSAGES and updated the HTTPException detail inside the file size validation block to reference the newly created config key.

Related Issues

Closes #635

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add size limits to uploaded files and clear error messages

1 participant