fix(read): prioritize known text extensions - #3848
Conversation
Co-Authored-By: ForgeCode <noreply@forgecode.dev>
|
Hi @tusharmath, when you have a chance, would you mind reviewing this MIME-detection fix and letting me know if any changes are needed? Thank you! Co-Authored-By: ForgeCode noreply@forgecode.dev |
|
Action required: PR inactive for 5 days. |
|
Status update: this PR is still active and ready for review. The current head remains Validation recorded for this unchanged head includes 28/28 focused Maintainers, could you please review this when available and approve the gated workflows if appropriate? Thank you. Co-Authored-By: ForgeCode noreply@forgecode.dev |
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