Skip to content

Conversation

@dduponchel
Copy link
Contributor

A common mistake is to put a data url (from a canvas for example) as a base64
content. In that case, we got a float value as the computed length of the
result and creating an Uint8Array threw an error.

This commit hardens the base64 decode: if the computed length is not an
integer or if the content looks like a data url, a better error is
thrown (instead of "TypeError: invalid arguments").

A common mistake is to put a data url (from a canvas for example) as a base64
content. In that case, we got a float value as the computed length of the
result and creating an Uint8Array threw an error.

This commit hardens the base64 decode: if the computed length is not an
integer or if the content looks like a data url, a better error is
thrown (instead of "TypeError: invalid arguments").
@dduponchel dduponchel merged commit b1156b5 into Stuk:master Jul 25, 2016
@dduponchel dduponchel deleted the base64_decode branch July 25, 2016 20:13
@dduponchel dduponchel mentioned this pull request Aug 2, 2016
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