FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix(read): prioritize known text extensions by original4422 · Pull Request #3848 · tailcallhq/forgecode · GitHub

fix(read): prioritize known text extensions - #3848

Open
original4422 wants to merge 1 commit into
tailcallhq:mainfrom
original4422:fix/3812-text-mime-detection
Open

fix(read): prioritize known text extensions#3848
original4422 wants to merge 1 commit into
tailcallhq:mainfrom
original4422:fix/3812-text-mime-detection

Conversation

Copy link
Copy Markdown

Summary

  • Treat known text extensions as authoritative before content sniffing, preventing embedded magic-byte literals from turning source files into image/PDF payloads.
  • Preserve infer detection for unknown and extensionless files and preserve the existing extension fallback.
  • Exercise the real ForgeFsRead path and MIME compatibility matrix with same-file regression tests.

Root cause

infer::get scans the entire supplied buffer and recognizes the %PDF sequence 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 passed
  • cargo test -p forge_services — 216 passed; doc tests passed
  • cargo check -p forge_services — passed
  • cargo clippy -p forge_services --all-targets --all-features -- -D warnings — passed
  • cargo fmt -p forge_services -- --check — passed
  • git diff --check — passed

cargo insta test was unavailable because the local cargo-insta command is not installed, so the complete crate suite was run directly with cargo test. A workspace-wide clippy attempt stopped while building the untouched forge_repo crate because local protoc is absent; CI installs protoc, and the touched crate's all-target/all-feature clippy is green.

Fixes #3812

Co-Authored-By: ForgeCode noreply@forgecode.dev

Co-Authored-By: ForgeCode <noreply@forgecode.dev>
Copilot AI lite review requested due to automatic review settings August 20, 2026 01:34

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

github-actions Bot added the type: fix Iterations on existing features or infrastructure. label Aug 20, 2026

CLAassistant commented Aug 20, 2026
edited
Loading

Copy link
Copy Markdown


All committers have signed the CLA.

Copy link
Copy Markdown
Author

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

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

Labels

type: fix Iterations on existing features or infrastructure.

Projects

None yet

3 participants


Back | FazBrowse Home | New Git URL