-
Notifications
You must be signed in to change notification settings - Fork 388
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bad decoding of concatenated Base64 files #42
Comments
What is the reason you want this library to support concatenated base64 files? Node.js doesn't support that. Buffer.from('SQ==QU0=', 'base64')
<Buffer 49> If anything, we should abort when we see |
I feel like this is a fairly standard feature. Wikipedia even says the following about padding bytes:
This feature is supported by Chrome when using Data URLs, and in GNU coreutils: While decoding concatenated base64 strings is helpful to me, it's not necessary. If it's not supported, ideally the limitation would be documented. I agree that aborting when padding bytes are found would be better than the current behavior because it would make the error obvious instead of producing a corrupted bitstream. |
We now abort when padding bytes are found, so we match Node.js behavior. |
1.3.0 |
The library doesn't support decoding concatenated base64 files because it doesn't handle padding characters correctly when they are not located at the end of the stream.
For example, 'SQ==QU0=' should decode to [73,65,77] but it decodes to [73,0,0,65,77].
I have modfied the convert.js tests to show the problem in this patch base64-concat.txt.
The text was updated successfully, but these errors were encountered: