Commit 20e7854
fix: rune-safe byte slicing in token estimator, error snippets, and maskKey
- restore/render.go: countTokens used len(text)/4 (bytes) instead of
utf8.RuneCountInString(text)/4 (runes) — inflated estimate for any
text containing multi-byte characters (CJK, emoji, accented chars)
- api/client.go: HTTP error snippet was truncated at byte offset 300,
risking invalid UTF-8 when a multi-byte character straddles that boundary
- setup/wizard.go: maskKey sliced the key at byte positions 8 and len-4;
same class of bug fixed elsewhere in the codebase
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent af77745 commit 20e7854
3 files changed
Lines changed: 8 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
313 | 313 | | |
314 | 314 | | |
315 | 315 | | |
316 | | - | |
317 | | - | |
| 316 | + | |
| 317 | + | |
318 | 318 | | |
319 | 319 | | |
320 | 320 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| |||
288 | 289 | | |
289 | 290 | | |
290 | 291 | | |
291 | | - | |
| 292 | + | |
292 | 293 | | |
293 | 294 | | |
294 | 295 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
194 | 194 | | |
195 | 195 | | |
196 | 196 | | |
197 | | - | |
198 | | - | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
199 | 200 | | |
200 | | - | |
| 201 | + | |
201 | 202 | | |
202 | 203 | | |
203 | 204 | | |
| |||
0 commit comments