Commit 454e727
fix: improve binary content detection and null byte handling (#210)
- Add binary content detection based on null byte percentage (>5%)
- Add control character validation to avoid processing binary files as text
- Remove null bytes from decoded text content to prevent downstream issues
- Add logging for binary content detection and null byte removal
This prevents potential issues when processing files that contain null bytes
or other binary data that could cause problems in text processing pipelines.
The fix uses a 5% threshold for null bytes to distinguish between text files
with occasional null bytes and truly binary content.
Co-authored-by: OpenClaw Integration <openclaw@example.com>1 parent 3be6d0a commit 454e727
1 file changed
+19
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
65 | 75 | | |
66 | 76 | | |
67 | 77 | | |
68 | | - | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
69 | 83 | | |
70 | 84 | | |
71 | 85 | | |
| |||
77 | 91 | | |
78 | 92 | | |
79 | 93 | | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
80 | 98 | | |
81 | 99 | | |
82 | 100 | | |
| |||
0 commit comments