Skip to content

Conversation

patrickdappollonio
Copy link
Owner

Some file extensions, such as .go would incorrectly be assumed to be binaries.

This uses a better library to perform such detection.

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes an issue where certain file extensions (like .go) were incorrectly being treated as binary files during content inspection. The change replaces the MIME type-based detection with a more robust content-based detection approach.

  • Replace mime_guess library with content_inspector for binary vs text detection
  • Increase buffer size from 512 to 1024 bytes for better content analysis
  • Switch from path-based MIME detection to actual content inspection

Reviewed Changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated no comments.

File Description
src/scanner.rs Updates the is_text_file method to use content-based detection instead of MIME type guessing
Cargo.toml Adds the content_inspector dependency for improved binary detection
Comments suppressed due to low confidence (1)

Cargo.toml:23

  • The version "0.2" of the content_inspector crate does not exist. The latest available version is "0.2.4". Consider using a more specific version like "0.2.4" or a range like "0.2" if you want to allow patch updates.
content_inspector = "0.2"

@patrickdappollonio patrickdappollonio merged commit 4a37121 into main Jul 25, 2025
2 checks passed
@patrickdappollonio patrickdappollonio deleted the fix-content-inspection branch July 25, 2025 03:47
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.

1 participant