| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
| } | ||
|
|
||
| /// Returns true if the Content-Type header indicates binary (non-text) content. | ||
| fn is_binary_content_type(content_type: &str) -> bool { |
There was a problem hiding this comment.
There is a util function we created to detect binary.
Sorry, something went wrong.
There was a problem hiding this comment.
ok let me find it don't think it was based on contect-type header
Sorry, something went wrong.
There was a problem hiding this comment.
there is no binary detection on http-headers, its on file system. I have moved this to util as we don't want to download and then fail we should fail fast.
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Summary
Reject binary responses in fetch and harden HTML sniffing to avoid UTF-8 boundary panics.
Context
The fetch tool is designed for text-based web content. Binary endpoints (for example archive downloads) can produce unreadable output and confusing failures when treated as text. The initial HTML sniffing logic also sliced by byte index, which could panic on multibyte UTF-8 boundaries.
Changes
Key Implementation Details
Binary detection is implemented via is_binary_content_type, which allowlists text-oriented content types (text/*, JSON, XML, JavaScript, YAML, TOML, CSV, HTML, SVG, Markdown, and empty content-type) and treats all others as binary.
Use Cases
Testing
cargo test -p forge_services test_is_binary_content_type -- --nocaptureLinks