HomePhabricator
Diffusion Comm d42495a7d3be

[native] Fix failing base64 decode for thumbhash

Description

[native] Fix failing base64 decode for thumbhash

Summary:
Fixes ENG-6031. It appears that ThumbhashModule sometimes returns base64 string containing newlines, which causes issues during encryption. More details in the linked issue description.

Even though still not sure if Android code is supposed to return base64 string with newlines, I decided to fix it by simply stripping them in JS. This is more future-proof than experimenting with native flags for base64 encoding.

Test Plan:
I wasn't able to repro Android Base64.encodeToString() returning newline so I appended it manually for testing:

  • Confirmed that C++ is_valid_base64() returns false for this kind of thumbhash -> causes encryption failure
  • Confirmed that my fix makes is_valid_base64() return true -> encryption succeeds -> cannot reporduce anymore with my manually appended \n.

Reviewers: atul, tomek

Reviewed By: atul, tomek

Subscribers: ashoat

Differential Revision: https://phab.comm.dev/D10310

Details

Provenance
bartekAuthored on Dec 12 2023, 3:53 AM
Reviewer
atul
Differential Revision
D10310: [native] Fix failing base64 decode for thumbhash
Parents
rCOMM9aaf6daf05bc: [terraform] change protocol version from grpc -> http2
Branches
Unknown
Tags
Unknown