Skip to content

fix(iris): binary-safe base64 decoding for profile downloads#4422

Merged
rjpower merged 1 commit intomainfrom
claude/pr-4415-20260404-1605
Apr 4, 2026
Merged

fix(iris): binary-safe base64 decoding for profile downloads#4422
rjpower merged 1 commit intomainfrom
claude/pr-4415-20260404-1605

Conversation

@rjpower
Copy link
Copy Markdown
Collaborator

@rjpower rjpower commented Apr 4, 2026

Fix binary data corruption in memray .bin downloads. The download path used atob()Blob([string]), which UTF-8 encodes the string and corrupts non-ASCII bytes. Now uses Uint8Array to preserve raw bytes.

Followup to #4415.

Generated with Claude Code

…downloads

The download path used atob() → Blob([string]), which UTF-8 encodes the
string and corrupts non-ASCII bytes in binary memray .bin traces. Convert
base64 to Uint8Array via charCodeAt() to preserve raw bytes.

Fixes both useProfileAction.ts and JobDetail.vue.

Co-authored-by: Russell Power <rjpower@users.noreply.github.com>
@claude
Copy link
Copy Markdown
Contributor

claude Bot commented Apr 4, 2026

Claude finished @rjpower's task in 47s —— View job


PR Review: Binary-safe base64 decoding for profile downloads

  • Read changed files and PR diff
  • Review for correctness and issues
  • Post review feedback

Verdict: Looks good. The fix is correct — atob() returns a "binary string" where each char is 0–255, but passing that string directly to Blob re-encodes it as UTF-8, corrupting any byte ≥ 0x80. The Uint8Array + charCodeAt pattern is the standard workaround.

Two minor observations:

  1. Duplicated decode logic in JobDetail.vue: The inline decode in JobDetail.vue:425-429 duplicates the new base64ToBytes() helper in useProfileAction.ts. Consider importing and reusing base64ToBytes to keep one implementation. Fix this →

  2. Thread dump path still uses atob directly (useProfileAction.ts:31): This is fine since thread dumps are text (UTF-8 safe), but worth a brief inline comment noting why atob is safe there vs. the binary path, to prevent a future reader from "fixing" it to use base64ToBytes and then rendering it as bytes instead of a string.

Otherwise the change is clean and well-scoped. 👍

@rjpower rjpower merged commit 283df59 into main Apr 4, 2026
38 of 39 checks passed
@rjpower rjpower deleted the claude/pr-4415-20260404-1605 branch April 4, 2026 18:23
Helw150 pushed a commit that referenced this pull request Apr 8, 2026
Fix binary data corruption in memray .bin downloads. The download path
used `atob()` → `Blob([string])`, which UTF-8 encodes the string and
corrupts non-ASCII bytes. Now uses `Uint8Array` to preserve raw bytes.

Followup to #4415.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant