Closed levibuzolic closed 2 weeks ago
@levibuzolic, thank you for the report. This does look like a bug. I'll work on a fix.
Fixed in Hermes with 0888914515ba3436d0e64dab05dc18166998bdb0
@dannysu thanks so much for jumping on this so quickly. 🙇♂️
Bug Description
gradle clean
and confirmed this bug does not occur with JSCHermes git revision (if applicable): 6285c8be11d22c30997e84b0cb8087bce127f1d6 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.