Skip to content

fix: support .wmf file extension case-insensitively and remove duplicate avi - #15498

Merged
JinHai-CN merged 7 commits into
infiniflow:mainfrom
Wsp030914:fix-wmf-file-type-detection
Aug 27, 2026
Merged

JinHai-CN merged 7 commits into
infiniflow:mainfrom
Wsp030914:fix-wmf-file-type-detection

Conversation

@Wsp030914

@Wsp030914 Wsp030914 commented Jun 2, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fix .wmf file type detection by matching lowercased filename normalization in both Python and Go extension checks.

This PR also removes a duplicate avi entry from the Python visual file type regex.

Testing

  • Verified filename_type("test.wmf") returns FileType.VISUAL.
  • Ran ruff format --check api/utils/file_utils.py.

@dosubot dosubot Bot added size:XS This PR changes 0-9 lines, ignoring generated files. 🐞 bug Something isn't working, pull request that fix bug. labels Jun 2, 2026
@coderabbitai

coderabbitai Bot commented Jun 2, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 13db553f-19ef-4e5d-9658-f4b2f8a43462

📥 Commits

Reviewing files that changed from the base of the PR and between ec9c08d and 98938cb.

📒 Files selected for processing (2)
  • api/utils/file_utils.py
  • internal/utility/file.go
🚧 Files skipped from review as they are similar to previous changes (2)
  • internal/utility/file.go
  • api/utils/file_utils.py

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

Updated visual-extension checks in Python and Go to use lowercase wmf. This matches filename normalization and classifies .wmf files as visual files.

Changes

File Type Classification

Layer / File(s) Summary
WMF extension matching
api/utils/file_utils.py, internal/utility/file.go
The visual-extension checks now use lowercase wmf. The Python regex also removes a duplicate avi alternative. .wmf files are classified as visual files.

Estimated code review effort: 1 (Trivial) | ~3 minutes

Merge Risk: ⚪ Minimal · up to 98938

This PR makes a localized file-extension matching fix and removes a duplicate pattern entry; no actionable merge-blocking risk remains beyond normal checks and review.

Poem

🐰 Lowercase wmf now matches right,
Python and Go classify it in sight,
A duplicate avi hops away,
Visual files find their path today.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the .wmf detection fix and duplicate avi removal.
Description check ✅ Passed The description includes the required Summary section, explains the changes, and documents testing performed.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this 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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 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.

Inline comments:
In `@api/utils/file_utils.py`:
- Line 76: The visual extension check in internal/utility/file.go is
case-sensitive because the filename is normalized with strings.ToLower(base) but
the visualExtensions slice contains "WMF" (uppercase); update the
visualExtensions slice so all entries are lowercase (change "WMF" to "wmf" and
ensure other entries are lowercase) so that the HasSuffix checks
(strings.HasSuffix(normalized, "."+ext)) correctly match `.wmf`; adjust the
visualExtensions declaration accordingly.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c010abd3-63c1-4f12-bcb6-40915205eb6f

📥 Commits

Reviewing files that changed from the base of the PR and between 33ef724 and 35ce78f.

📒 Files selected for processing (1)
  • api/utils/file_utils.py

Comment thread api/utils/file_utils.py Resolved
@coderabbitai

coderabbitai Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

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.

@JinHai-CN JinHai-CN added the ci Continue Integration label Aug 18, 2026
@JinHai-CN

Copy link
Copy Markdown
Member
╭──────────────────────────────────────────╮
│ 🥊 lefthook  v2.1.10   hook:  pre-commit │
╰──────────────────────────────────────────╯
│  web-checks ❯ web-deps (skip) no matching staged files
│  web-checks ❯ web-oxfmt (skip) no files for inspection
│  web-checks ❯ web-oxlint (skip) no files for inspection
┃  gofmt ❯ 

┃  ruff-format ❯ 
Would reformat: api/utils/file_utils.py
1 file would be reformatted

Would you please fix the format issue?

@Wsp030914

Copy link
Copy Markdown
Contributor Author
╭──────────────────────────────────────────╮
│ 🥊 lefthook  v2.1.10   hook:  pre-commit │
╰──────────────────────────────────────────╯
│  web-checks ❯ web-deps (skip) no matching staged files
│  web-checks ❯ web-oxfmt (skip) no files for inspection
│  web-checks ❯ web-oxlint (skip) no files for inspection
┃  gofmt ❯ 

┃  ruff-format ❯ 
Would reformat: api/utils/file_utils.py
1 file would be reformatted

Would you please fix the format issue?

Thanks for pointing this out. I’ve formatted api/utils/file_utils.py with ruff and pushed the fix in commit 6ab1fd5fc.

@codecov

codecov Bot commented Aug 18, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 39.09%. Comparing base (48c6c54) to head (38730c0).
⚠️ Report is 18 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##             main   #15498       +/-   ##
===========================================
- Coverage   91.34%   39.09%   -52.25%     
===========================================
  Files          10       54       +44     
  Lines         716    14914    +14198     
  Branches      117      117               
===========================================
+ Hits          654     5831     +5177     
- Misses         36     9057     +9021     
  Partials       26       26               

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Wsp030914

Copy link
Copy Markdown
Contributor Author

@JinHai-CN The failed Infinity jobs look unrelated to this PR.

ragflow_tests_infinity (go) failed with a runner port conflict: address already in use.
ragflow_tests_infinity (python) failed with a timeout in test_chunk_concurrent_add_contract[20].

Could you please rerun the failed jobs? I don't have permission to rerun them.

@coderabbitai

coderabbitai Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

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.

@Wsp030914

Copy link
Copy Markdown
Contributor Author

Added regression coverage for .wmf detection in both Python and Go.

  • Python: filename_type("test.wmf") and filename_type("TEST.WMF")
  • Go: FilenameType("test.wmf") and FilenameType("TEST.WMF")

Also ran the related tests locally:

  • pytest test/unit_test/api/utils/test_api_file_utils.py -q
  • go test ./internal/utility

@Wsp030914

Copy link
Copy Markdown
Contributor Author

@JinHai-CN Thanks for your help. I fixed the ruff-format issue and added regression tests for .wmf detection in
both Python and Go.

The CI checks are passing now. Could you please take another look when you have time?

@JinHai-CN
JinHai-CN merged commit 8b75e86 into infiniflow:main Aug 27, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐞 bug Something isn't working, pull request that fix bug. ci Continue Integration size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants