matrix-org / matrix-js-sdk

Matrix Client-Server SDK for JavaScript
Apache License 2.0
1.49k stars 577 forks source link

Correctly transform base64 with multiple instances of + or / #4252

Closed robintown closed 1 week ago

robintown commented 1 week ago

String.replace only replaces a single instance of the search pattern by default; we need a regex in g mode if we want to replace them all.

For https://github.com/element-hq/element-call/issues/2429

dbkr commented 1 week ago

🤦 Good spot

t3chguy commented 1 week ago

There's also replaceAll nowadays https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replaceAll

robintown commented 1 week ago

I saw that, it would've required me to bump our TypeScript ES target though so I decided not to bother