Commit 5cfbdab
fix: browser base64 encoding for Snap image data
When loading TD Snap (.sps) files client-side in browser, sql.js
returns image data as Uint8Array not Node.js Buffer. Uint8Array's
toString() method doesn't accept 'base64' encoding parameter like
Buffer does, so it was converting bytes to comma-separated decimal
values instead of proper base64 encoding.
Added arrayBufferToBase64() helper that works in both Node.js and
browser environments using the appropriate method for each.
Fixes image loading error:
src: data:image/png;base64,137,80,78,71,13,10,26...
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>1 parent 09c1d6b commit 5cfbdab
1 file changed
Lines changed: 22 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
23 | 44 | | |
24 | 45 | | |
25 | 46 | | |
| |||
556 | 577 | | |
557 | 578 | | |
558 | 579 | | |
559 | | - | |
| 580 | + | |
560 | 581 | | |
561 | 582 | | |
562 | 583 | | |
| |||
0 commit comments