fix: upgrade isbinaryfile from 5.0.4 to 5.0.7 #9192
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.
fix: upgrade isbinaryfile from 5.0.4 to 5.0.7
Upstream package fix: gjtorikian/isBinaryFile#91
Related GitHub Issue
Closes: #8109
Resolves: #6242 (duplicate)
Roo Code Task Context (Optional)
N/A
Description
This PR upgrades the
isbinaryfiledependency to fix a critical bug that affects Roo-Code's ability to process files containing multibyte UTF-8 characters (Chinese, Japanese, Korean, emoji, etc.).Problem:
When processing files with non-ASCII characters (as reported in #8109 and #6242), Roo-Code encountered a "RangeError: Invalid array length" error due to a bug in
[email protected]. This bug occurs when UTF-8 multibyte sequences are split across the 512-byte buffer boundary used for file type detection.Error Stack Trace (from both #6242 and my reproduction):
Root Cause:
[email protected]: Array handling issues causing crashes with certain UTF-8 files[email protected]: Fixed crashes but introduced a new bug where valid text files are misdetected as binary[email protected]: Comprehensive fix for both issues ✅Solution:
I authored the upstream fix (gjtorikian/isBinaryFile#91) which properly handles UTF-8 multibyte sequences at buffer boundaries by:
This PR updates the dependency constraint from
^5.0.2to^5.0.7to ensure all installations receive the fix.Changes:
Note: The previous constraint
^5.0.2allowed installation of buggy version 5.0.4. The new constraint^5.0.7ensures the fixed version is always used.Test Procedure
Manual Testing:
utf8-boundary-truncation_case.pyExpected Results:
Pre-Submission Checklist
Screenshots / Videos
Before ([email protected]) - Error State:
Error shown: "未捕获的错误(2)" - "invalid array length" when processing UTF-8 file with Chinese comments. Roo-Code fails to analyze the file.
After ([email protected]) - Fixed:
Success: "任务完成" - File is successfully recognized as text and processed by Roo-Code AI agents. Note the green "No Error This Time!" indicator in the console.
Documentation Updates
This is a dependency bug fix with no user-facing feature changes.
Additional Notes
Related Issues:
This PR fixes the root cause of two reported issues:
Both issues report the same problem: Roo-Code extension freezes when processing files containing Chinese characters (or other multibyte UTF-8 sequences) at specific buffer boundary positions.
Reproduced and Verified:
I've personally reproduced the exact same error stack trace reported in #6242:
The error occurs at the exact same code location when processing files containing UTF-8 multibyte sequences (Chinese characters) at byte positions 510-512.
Test File Used:
utf8-boundary-truncation_case.pyVerification:
[email protected]: Reproduced theRangeError: Invalid array lengthcrash[email protected]: File is correctly identified as text, no errorsImpact on Roo-Code Users:
This fix is particularly important for:
Upstream Package Contribution:
I'm the author of the upstream fix:
Get in Touch
GitHub: @f14XuanLv
Discord: f14xuanlv
Important
Upgrade
isbinaryfileto^5.0.7to fix UTF-8 file processing crash and ensure correct text file detection.isbinaryfilefrom^5.0.2to^5.0.7inpackage.jsonandpnpm-lock.yaml.[email protected].This description was created by
for 001c1c6. You can customize this summary. It will automatically update as commits are pushed.