strip junk bytes from base64 more safely

This commit is contained in:
ansuz 2017-05-10 18:15:33 +02:00
parent 1525712deb
commit 6d30d7f89f

View File

@ -21,7 +21,7 @@ define([], function () {
.replace(/ +$/, "") .replace(/ +$/, "")
.split(" "); .split(" ");
var byteString = String.fromCharCode.apply(null, hexArray); var byteString = String.fromCharCode.apply(null, hexArray);
return window.btoa(byteString).replace(/\//g, '-').slice(0,-2); return window.btoa(byteString).replace(/\//g, '-').replace(/=+$/, '');
}; };
Util.base64ToHex = function (b64String) { Util.base64ToHex = function (b64String) {