Repository navigation
fix: allow .bmp uploads in filename type whitelist - #17830
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (3)
📝 WalkthroughWalkthroughThe PR adds ChangesFilename classification
Estimated code review effort: 2 (Simple) | ~5 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
internal/utility/filename_type_test.go (1)
21-37: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winCover every newly accepted extension.
The implementation changes include
.iconinapi/utils/file_utils.pyLine 76 and.jpgininternal/utility/file.goLine 160. This table tests.bmp,.png, and.exe, but not.iconor.jpg. Add direct cases for those extensions, or point to equivalent existing tests. Keep Python and Go classification coverage aligned.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@internal/utility/filename_type_test.go` around lines 21 - 37, Extend TestFilenameTypeBMP’s cases to directly cover the newly accepted .icon and .jpg extensions, expecting FileTypeVISUAL for both. Keep the existing BMP, PNG, and EXE cases unchanged so Go classification coverage remains aligned with the Python file extension changes.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@internal/utility/filename_type_test.go`:
- Around line 21-37: Extend TestFilenameTypeBMP’s cases to directly cover the
newly accepted .icon and .jpg extensions, expecting FileTypeVISUAL for both.
Keep the existing BMP, PNG, and EXE cases unchanged so Go classification
coverage remains aligned with the Python file extension changes.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: fdecc66c-6a27-46e9-88dd-63fe917fced1
📒 Files selected for processing (3)
api/utils/file_utils.pyinternal/utility/file.gointernal/utility/filename_type_test.go
Frontend Images and picture parsers already treat bmp as visual, but upload gates filename_type/FilenameType reject it as OTHER. Co-authored-by: Cursor <[email protected]>
c1a83bb to
228bfdb
Compare
Follow-upRebased onto latest About the previous Python CI failures
Go paths already passed ( This PR only adds
Picture parsing already accepts CodeRabbit nitThe suggestion to add Request@JinHai-CN could you please re-trigger CI / take another look when convenient? Happy to re-run if the SiliconFlow CI credential issue is resolved on the runner side. |
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #17830 +/- ##
=======================================
Coverage 90.65% 90.65%
=======================================
Files 10 10
Lines 717 717
Branches 118 118
=======================================
Hits 650 650
Misses 39 39
Partials 28 28 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Summary
Imagesalready includesbmp(web/src/constants/common.ts), and picture parsing already accepts.bmp(internal/parser/parser/picture_parser.go,rag/app/picture.pyvia Pillow)..bmpbecause the gate functions omit it from the visual whitelist:api/utils/file_utils.py→filename_type()internal/utility/file.go→FilenameType()(used bydocument_upload.go)This type of file has not been supported yet!even for valid BMP files under size limits.bmpto both whitelist sites and a small Go unit test.Why this is inconsistent
.bmpImages/ previewGetFileType()(Go)filename_type/FilenameTypeTest plan
go test ./internal/utility/ -run TestFilenameTypeBMP.bmpvia dataset document API → success (typevisual, parserpicture).png/.jpgupload behavior unchanged.exe) still rejectedMade with Cursor