Repository navigation
fix: classify .wmf files as VISUAL instead of OTHER - #15822
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 (2)
🚧 Files skipped from review as they are similar to previous changes (2)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughThis PR updates ChangesFile extension type detection
Estimated code review effort: 1 (Trivial) | ~3 minutes Merge Risk: ⚪ Minimal · up to This localized fix correctly routes WMF files to the visual-file handling path and adds regression coverage for both common casing variants; no actionable merge-blocking risk remains beyond normal checks and review. Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Full details: Description checkExplanation The description provides the problem, technical cause, fix, affected behavior, tests, and verification results. It does not use the exact template heading "### Summary", but it is otherwise complete and directly related to the pull request. 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 |
cd1db20 to
4dab471
Compare
filename_type lowercases the filename via _normalize_filename_for_type before matching, but the VISUAL extension pattern listed wmf in uppercase (WMF). Since the candidate is always lowercased, the WMF alternative was unreachable and .wmf files fell through to OTHER, so they bypassed the image/picture parser that the VISUAL type routes to. Every other extension in the alternation is lowercase. Change WMF to wmf. Signed-off-by: Yash Raj Pandey <[email protected]>
4dab471 to
6622127
Compare
|
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. |
|
Rebased onto current main to clear the conflict. The PR is mergeable again. The conflict was on the same line as the fix. #17830 added I re-checked the behaviour against current main by running the real
The 1 commit, 2 files, +3/-1. |
|
@JinHai-CN could you assign a reviewer here as well? This one also has none. I rebased it on 19 August to clear the conflict with #17830. The line now carries both the |
|
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 #15822 +/- ##
==========================================
- Coverage 94.56% 90.65% -3.91%
==========================================
Files 10 10
Lines 717 717
Branches 118 118
==========================================
- Hits 678 650 -28
- Misses 25 39 +14
- Partials 14 28 +14 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
What
filename_type()classifies.wmffiles asOTHERinstead ofVISUAL.filename_typefirst calls_normalize_filename_for_type, which lowercases the name (base.lower()), and then matches against the extension patterns. But the VISUAL pattern lists WMF in uppercase:r".*\.(jpg|jpeg|png|...|eps|ai|raw|WMF|webp|avif|...)$"Since the candidate is always lowercased before matching, the
WMFalternative can never match any casing of a.wmffile. Every other extension in the same alternation is lowercase, so this is a typo. WMF (a vector/image format, commonly extracted from Office documents) therefore falls through toOTHERand bypasses the picture/image parser that theVISUALtype routes to (FileService.get_parser, and theVISUALbranches in document handling).Fix
Lowercase the one extension so it matches:
WMF->wmf.Tests
Added
("pic.wmf", VISUAL)and("pic.WMF", VISUAL)to the existingtest_valid_filenamesparametrization intest/unit_test/api/utils/test_api_file_utils.py. Both fail before the change (returnOTHER) and pass after. Verified the realfilename_typedirectly:.wmf/.WMFgo fromothertovisual, while existing controls (x.png,movie.mp4) stayvisual.ruff checkclean.