From 6d30d7f89fda0ceb88bf153c917d91e0a2cfa592 Mon Sep 17 00:00:00 2001 From: ansuz Date: Wed, 10 May 2017 18:15:33 +0200 Subject: [PATCH] strip junk bytes from base64 more safely --- www/common/common-util.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/www/common/common-util.js b/www/common/common-util.js index f5ba9a61c..e62ed7016 100644 --- a/www/common/common-util.js +++ b/www/common/common-util.js @@ -21,7 +21,7 @@ define([], function () { .replace(/ +$/, "") .split(" "); 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) {