Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[native] Fix failing base64 decode for thumbhash
Summary: Fixes [[ https://linear.app/comm/issue/ENG-6031/video-encryption-failed | 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 [[ https://developer.android.com/reference/android/util/Base64#encodeToString(byte%5B%5D,%20int) | 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
- Loading branch information