feat: add file upload size limit with friendly error messages#366
Conversation
SpursJiang
commented
Sep 14, 2025
- Add file upload size validation with user-friendly error messages
- Implement HandshakeController to communicate size limits to frontend
- Add GlobalExceptionHandler for handling file size exceeded errors
- Update FileTransferForm to show clear size limit warnings
- Add bilingual documentation for file upload configuration
- Support both English and Chinese error messages
- Add file upload size validation with user-friendly error messages - Implement HandshakeController to communicate size limits to frontend - Add GlobalExceptionHandler for handling file size exceeded errors - Update FileTransferForm to show clear size limit warnings - Add bilingual documentation for file upload configuration - Support both English and Chinese error messages Signed-off-by: jiangpeng <949474720@qq.com>
- Fix test compatibility issue by making MultipartProperties parameter optional - Add null check to prevent NullPointerException in test environments - Ensure file size limit feature works when MultipartProperties is available Signed-off-by: spursjiang <949474720@qq.com>
There was a problem hiding this comment.
Pull Request Overview
This PR implements configurable file upload size limits with comprehensive user experience improvements. It adds dynamic size validation, friendly error messages in both English and Chinese, and seamless communication between backend configuration and frontend interface.
- Dynamic file size limit configuration retrieved from backend via handshake API
- Comprehensive file upload error handling with size-specific messages
- Frontend validation with immediate feedback and bilingual support
Reviewed Changes
Copilot reviewed 16 out of 17 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| site/docs/zh/guide/file-upload-configuration.md | New comprehensive Chinese documentation for file upload configuration |
| site/docs/zh/guide/configuration.md | Added Chinese documentation for multipart configuration properties |
| site/docs/guide/file-upload-configuration.md | New comprehensive English documentation for file upload configuration |
| site/docs/guide/configuration.md | Added English documentation for multipart configuration properties |
| site/docs/guide/changelog.md | Updated changelog with file upload enhancement features |
| server/src/main/java/org/eclipse/jifa/server/util/ErrorUtil.java | Added utility method for creating structured error responses |
| server/src/main/java/org/eclipse/jifa/server/enums/ServerErrorCode.java | Added FILE_TOO_LARGE error code for file size violations |
| server/src/main/java/org/eclipse/jifa/server/domain/dto/HandshakeResponse.java | Extended handshake response to include maximum file size configuration |
| server/src/main/java/org/eclipse/jifa/server/controller/HandshakeController.java | Enhanced controller to communicate file size limits to frontend |
| server/src/main/java/org/eclipse/jifa/server/controller/GlobalExceptionHandler.java | Added comprehensive file upload size exception handling |
| frontend/src/stores/env.ts | Added file size limit storage and management in environment store |
| frontend/src/i18n/zh.ts | Added Chinese translations for file upload messages |
| frontend/src/i18n/en.ts | Added English translations for file upload messages |
| frontend/src/components/forms/FileTransferForm.vue | Enhanced upload form with size validation and error handling |
| analysis/gc-log/src/test/java/org/eclipse/jifa/gclog/TestFragmentedParserToMetrics.java | Fixed comma placement in printf statement |
| analysis/gc-log/src/main/java/org/eclipse/jifa/gclog/parser/AbstractPreUnifiedGCLogParser.java | Fixed parenthesis character in comment |
Files not reviewed (1)
- frontend/package-lock.json: Language not supported
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
server/src/main/java/org/eclipse/jifa/server/controller/HandshakeController.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/eclipse/jifa/server/controller/GlobalExceptionHandler.java
Outdated
Show resolved
Hide resolved
|
eca has passed. |
- Fix null MultipartProperties handling in HandshakeController - Simplify fragile string parsing in GlobalExceptionHandler - Improve error.response type safety in FileTransferForm
|
Thanks for the suggestions! I've addressed all issues。 |
|
Could you please merge my pull request? |
server/src/main/java/org/eclipse/jifa/server/controller/GlobalExceptionHandler.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/eclipse/jifa/server/controller/GlobalExceptionHandler.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/eclipse/jifa/server/controller/GlobalExceptionHandler.java
Show resolved
Hide resolved
server/src/main/java/org/eclipse/jifa/server/controller/HandshakeController.java
Outdated
Show resolved
Hide resolved
|
Hi, sorry for the late response. I left some comments for this patch. Thanks for the contribution. |
…back - Remove duplicate formatFileSize function, reuse existing prettySize utility - Use unlimited size as default instead of hardcoded 512MB limit - Update copyright year to 2025 in GlobalExceptionHandler - Replace custom formatFileSize with Apache Commons FileUtils.byteCountToDisplaySize - Rename maxFileSizeBytes to maxUploadSize for better clarity - Refactor ErrorUtil.toJson to eliminate code duplication with shared buildJsonBytes method - Simplify file upload error handling logic to use 200 status code - Remove unused imports and clean up code structure - Ensure consistent configuration logic between HandshakeController and GlobalExceptionHandler
|
@D-D-H Thanks for the suggestions! I've addressed all issues。Could you please merge my pull request?
Thanks for the suggestions! I've addressed all issues。Could you please merge my pull request? |
|
@D-D-H Could you please review this PR? |
|
Merged. Thanks for the contribution. |