You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Base64 decode error points at the wrong character when the input has spaces or line breaks #310
Decode SGVs bG8! in the Base64 tool. The error says the illegal character "!" is at position 7, but in what you typed it's the 9th character. base64ToBytes (lib/base64-utils.ts, line 38) strips all whitespace first (line 41) and reports the index in the stripped string, counted from 0 (lines 48 to 53). With pasted multi-line Base64 the number is even further off.
What to do
Report where the character is in the original input, counted from 1. For input with line breaks, line and column is even clearer.
Where to look
lib/base64-utils.ts: base64ToBytes (lines 38 to 60)
lib/__tests__/base64-utils.test.ts
Acceptance criteria
SGVs bG8! reports position 9
An illegal character on the second line of multi-line input is reported where it really is
Tests that fail on the current code
npm run lint, npm run test and npm run build pass
Want to work on this? Comment below and I'll assign it to you. Please take one issue at a time, branch off develop, and open your PR against develop with Closes #310 in the description.
I'd like to work on this issue. I'll correct the Base64 decoder's error-position reporting so it refers to the original input, including whitespace and line breaks, and add regression tests for the reported case and related malformed inputs.
Activity
Aaqibhafeezkhan commentedon Oct 23, 2026
I'd like to work on this issue. I'll correct the Base64 decoder's error-position reporting so it refers to the original input, including whitespace and line breaks, and add regression tests for the reported case and related malformed inputs.
anurag629 commentedon Oct 23, 2026
Hey @Aaqibhafeezkhan, go for it! It's yours.
fix(base64): report original invalid character positions
fix(base64): report original invalid character positions (codercops#332)