Commit 130f460
committed
fix(fe): stream bodies into blobs, and stop refusing legitimate bidi text
Two review points on `appMetadata.ts`.
The capped reader accumulated chunks into a `Uint8Array`, so a logo of
up to the cap was materialized as a JS buffer on its way to being
re-encoded. It now pipes the response through a counting transform into
a `Blob` instead: the bytes accumulate in the browser's blob store, only
one chunk at a time is a JS buffer, and the blob goes straight to
`createImageBitmap`, so the encoded image is never a JS value at all.
The cap still bounds the transfer rather than just the result -- erroring
the transform aborts the source stream. The metadata document still
becomes a string, since 8 KiB of JSON has to be parsed.
Refusing every bidi and zero-width character broke exactly the names
that need them. The marks U+200E/U+200F/U+061C are how an Arabic name
ending in "!" or a Hebrew name with an embedded Latin word gets its
neutral characters on the right side; the isolates U+2066-U+2069 are
Unicode's recommended way to embed a run of unknown direction; U+200B is
a line-break opportunity in Thai and Khmer. None of them can reorder
text, so all are now accepted. What is refused is the set that can: the
embeddings and overrides U+202A-U+202E (plus control characters and
U+FEFF as before). Isolates additionally have to be balanced, so an
app's string cannot run past itself into the sentence II renders around
it, and a field has to contain at least one visible character, so an
all-invisible name is treated as absent instead of displayed as a blank.
The app-provided description also renders with `dir="auto"` now, which
resolves its direction from its own content and isolates it from the
screen.
The published JSON Schema follows, and notes the one rule it cannot
express (isolate balance).
Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ApQTUxtZxjzpFsoJqKCXxo1 parent 826858d commit 130f460
4 files changed
Lines changed: 180 additions & 82 deletions
File tree
- docs
- src/frontend/src/lib
- components/ui
- utils
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
357 | 357 | | |
358 | 358 | | |
359 | 359 | | |
360 | | - | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
361 | 363 | | |
362 | 364 | | |
363 | 365 | | |
| |||
366 | 368 | | |
367 | 369 | | |
368 | 370 | | |
369 | | - | |
| 371 | + | |
370 | 372 | | |
371 | 373 | | |
372 | 374 | | |
| |||
380 | 382 | | |
381 | 383 | | |
382 | 384 | | |
383 | | - | |
384 | | - | |
| 385 | + | |
| 386 | + | |
385 | 387 | | |
386 | 388 | | |
387 | 389 | | |
388 | 390 | | |
389 | 391 | | |
390 | 392 | | |
391 | | - | |
392 | | - | |
| 393 | + | |
| 394 | + | |
393 | 395 | | |
394 | 396 | | |
395 | 397 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
77 | 80 | | |
| 81 | + | |
78 | 82 | | |
79 | 83 | | |
80 | 84 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
322 | 322 | | |
323 | 323 | | |
324 | 324 | | |
325 | | - | |
326 | | - | |
327 | | - | |
328 | | - | |
329 | | - | |
330 | | - | |
331 | | - | |
332 | | - | |
333 | | - | |
334 | | - | |
335 | | - | |
336 | | - | |
337 | | - | |
338 | | - | |
339 | | - | |
340 | 325 | | |
341 | 326 | | |
342 | 327 | | |
| |||
368 | 353 | | |
369 | 354 | | |
370 | 355 | | |
371 | | - | |
372 | | - | |
373 | | - | |
374 | | - | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
375 | 360 | | |
376 | 361 | | |
377 | 362 | | |
378 | 363 | | |
379 | | - | |
380 | | - | |
381 | | - | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
382 | 368 | | |
383 | | - | |
384 | 369 | | |
385 | 370 | | |
386 | 371 | | |
| |||
394 | 379 | | |
395 | 380 | | |
396 | 381 | | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
397 | 435 | | |
398 | 436 | | |
399 | 437 | | |
| |||
0 commit comments