Skip to content

fix: improve binary detection with extension whitelist priority#17

Closed
Knowckx wants to merge 1 commit into
Fralleee:mainfrom
Knowckx:fix/binary-detection
Closed

fix: improve binary detection with extension whitelist priority#17
Knowckx wants to merge 1 commit into
Fralleee:mainfrom
Knowckx:fix/binary-detection

Conversation

@Knowckx
Copy link
Copy Markdown

@Knowckx Knowckx commented Jan 6, 2026

  • Prioritize known text extensions from languageMap (not binary)
  • Add KNOWN_BINARY_EXTENSIONS set for common binary formats
  • Use istextorbinary for content-based detection as fallback
  • Move file-type magic bytes detection to lowest priority

This fixes false positive binary detection for files like .svelte, .vue, .tsx that could be misidentified as binary due to magic bytes matching.

修复一个判断二进制的问题 目前.sevelte文件会被判断成二进制

- Prioritize known text extensions from languageMap (not binary)
- Add KNOWN_BINARY_EXTENSIONS set for common binary formats
- Use istextorbinary for content-based detection as fallback
- Move file-type magic bytes detection to lowest priority

This fixes false positive binary detection for files like .svelte, .vue, .tsx
that could be misidentified as binary due to magic bytes matching.
@Knowckx Knowckx requested a review from Fralleee as a code owner January 6, 2026 07:12
@Fralleee
Copy link
Copy Markdown
Owner

Fixed in #18

@Fralleee Fralleee closed this Jan 16, 2026
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.

2 participants