Repository navigation
Commit be350ee
committed
fix(grep): handle non-UTF-8 ripgrep output (lines.bytes)
When ripgrep encounters non-UTF-8 encoded files (e.g. GBK/GB2312),
it emits lines.bytes (base64) instead of lines.text. The zod schema
only accepted lines.text, causing parse failures that broke grep
for all searches in projects containing any non-UTF-8 files.
Add a TextOrBytes schema that accepts either text or bytes fields,
base64-decoding the bytes variant with lossy UTF-8 conversion.
Applied to both lines and submatches.match fields.
Fixes anomalyco#236291 parent a38d53f commit be350ee
1 file changed
Lines changed: 12 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
1 | 2 | | |
2 | 3 | | |
3 | 4 | | |
| |||
48 | 49 | | |
49 | 50 | | |
50 | 51 | | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
51 | 61 | | |
52 | 62 | | |
53 | 63 | | |
54 | 64 | | |
55 | 65 | | |
56 | 66 | | |
57 | | - | |
58 | | - | |
59 | | - | |
| 67 | + | |
60 | 68 | | |
61 | 69 | | |
62 | 70 | | |
63 | 71 | | |
64 | | - | |
65 | | - | |
66 | | - | |
| 72 | + | |
67 | 73 | | |
68 | 74 | | |
69 | 75 | | |
| |||
0 commit comments