fix(read): prioritize known text extensions - #3848
Open
original4422 wants to merge 1 commit into
Open
Conversation
Co-Authored-By: ForgeCode <noreply@forgecode.dev>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
inferdetection for unknown and extensionless files and preserve the existing extension fallback.ForgeFsReadpath and MIME compatibility matrix with same-file regression tests.Root cause
infer::getscans the entire supplied buffer and recognizes the%PDFsequence at byte offset 449. Limiting the buffer to the issue's suggested 1 KiB would still include that sequence and therefore would not fix this reproduction. The minimal reliable fix is to trust the existing known-text extension allowlist before content sniffing.Validation
cargo test -p forge_services tool_services::fs_read::tests -- --nocapture— 28 passedcargo test -p forge_services— 216 passed; doc tests passedcargo check -p forge_services— passedcargo clippy -p forge_services --all-targets --all-features -- -D warnings— passedcargo fmt -p forge_services -- --check— passedgit diff --check— passedcargo insta testwas unavailable because the localcargo-instacommand is not installed, so the complete crate suite was run directly withcargo test. A workspace-wide clippy attempt stopped while building the untouchedforge_repocrate because localprotocis absent; CI installsprotoc, and the touched crate's all-target/all-feature clippy is green.Fixes #3812
Co-Authored-By: ForgeCode noreply@forgecode.dev