Skip to content

Commit 2c269f9

Browse files
committed
[patch] fix qr base64 encoding function
In https://github.com/BranchMetrics/web-branch-deep-linking-attribution/pull/1075/files, i tried to clean up the function a little bit. However, i broke it. So, i returned the function to normal, but instead jammed the new encoding of the bytes in. So all should be good
1 parent b474851 commit 2c269f9

File tree

3 files changed

+48
-42
lines changed

3 files changed

+48
-42
lines changed

dist/build.js

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3106,13 +3106,18 @@ Branch.prototype.link = wrap(callback_params.CALLBACK_ERR_DATA, function(a, b) {
31063106
});
31073107
Branch.prototype.qrCode = wrap(callback_params.CALLBACK_ERR_DATA, function(a, b, c, d) {
31083108
utils.cleanLinkData(b).qr_code_settings = safejson.stringify(utils.convertObjectValuesToString(c || {}));
3109-
this._api(resources.qrCode, utils.cleanLinkData(b), (e, f) => e ? a(e, null) : a(null, {rawBuffer:f, base64() {
3110-
if (!this.rawBuffer) {
3111-
throw Error("QrCode.rawBuffer is empty.");
3109+
this._api(resources.qrCode, utils.cleanLinkData(b), function(e, f) {
3110+
function g() {
31123111
}
3113-
const g = Array.from(new Uint8Array(this.rawBuffer)).map(h => String.fromCharCode(h)).join("");
3114-
return btoa(g);
3115-
}}));
3112+
e || (g.rawBuffer = f, g.base64 = function() {
3113+
if (this.rawBuffer) {
3114+
const h = Array.from(new Uint8Array(this.rawBuffer)).map(k => String.fromCharCode(k)).join("");
3115+
return btoa(h);
3116+
}
3117+
throw Error("QrCode.rawBuffer is empty.");
3118+
});
3119+
return a(e || null, g || null);
3120+
});
31163121
});
31173122
Branch.prototype.deepview = wrap(callback_params.CALLBACK_ERR, function(a, b, c) {
31183123
var d = this;

0 commit comments

Comments
 (0)