atob
is less forgiving with padding than JSC, Node and browser based implementations
#1379
Closed
2 tasks done
Labels
bug
Something isn't working
Bug Description
gradle clean
and confirmed this bug does not occur with JSCHermes git revision (if applicable): 6285c8b
React Native version: 0.74.0
OS: macOS
Steps To Reproduce
Before I dive into the issue, I wanted to thanks to the team for implementing
btoa
andatob
, it's a great addition to the engine!It's a common convention for Base64 strings to have their trailing padding
=
trimmed to make them compatible with URIs. For example the string"hello"
would be encoded asaGVsbG8=
, but can usually be trimmed down toaGVsbG8
and still be decoded correctly.In JSC, Node, Chrome, Safari, Firefox:
hermes appears to be quite strict with its validation of base64 strings and will fail on the second case:
I also wanted to note that I'm not 100% sure if this is necessarily a bug, reading the spec for forgiving-base64 decode, I think it is. But if not, it's probably worth aligning the implementation to ensure compatibility.
The text was updated successfully, but these errors were encountered: