From 80894a21adb759c56f337c4f96463815b75fe6ed Mon Sep 17 00:00:00 2001 From: samartnik Date: Thu, 3 Jan 2019 11:48:46 -0500 Subject: [PATCH 1/2] README fixes --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 66fdeb8..a86a2cc 100644 --- a/README.md +++ b/README.md @@ -28,8 +28,8 @@ npm run start ## Testing The sync client uses Browserify to transform Node js into browser js. To unittest -the library in a browser (default: electron), run `npm browsertest`. -To test in a different browser run `npm browsertest -- --browser chrome`. +the library in a browser (default: electron), run `npm run browsertest`. +To test in a different browser run `npm run browsertest -- --browser chrome`. Results appear in both the browser inspector and your terminal. To run tests in Node, just do `npm test`. From 69de0dbdde4d33ef081fb6e8c872573fa81cad00 Mon Sep 17 00:00:00 2001 From: SergeyZhukovsky Date: Sun, 3 Feb 2019 16:02:10 -0500 Subject: [PATCH 2/2] Handled a situation where user more than one backslash in id --- client/requestUtil.js | 4 +--- lib/s3Helper.js | 4 ++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/client/requestUtil.js b/client/requestUtil.js index 6211bff..b4cc93d 100644 --- a/client/requestUtil.js +++ b/client/requestUtil.js @@ -49,8 +49,6 @@ const RequestUtil = function (opts = {}) { this.serializer = opts.serializer this.serverUrl = opts.serverUrl this.userId = Buffer.from(opts.keys.publicKey).toString('base64') - // For SQS notifications filter, we should keep / - this.userIdEncoded = encodeURIComponent(this.userId).replace('%2F', '/') // For SQS names, which don't allow + and / this.userIdBase62 = this.userId.replace(/[^A-Za-z0-9]/g, '') this.encrypt = cryptoUtil.Encrypt(this.serializer, opts.keys.secretboxKey, CONFIG.nonceCounter) @@ -203,7 +201,7 @@ RequestUtil.prototype.list = function (category, startAt, maxRecords, nextContin } return s3Helper.listNotifications(this.sqs, notificationParams, category, - `${this.apiVersion}/${this.userIdEncoded}/${category}`) + prefix) }) } diff --git a/lib/s3Helper.js b/lib/s3Helper.js index 456ef8b..ed73562 100644 --- a/lib/s3Helper.js +++ b/lib/s3Helper.js @@ -158,13 +158,13 @@ function listNotificationsRecursively (SQS, options, category, prefix, currentCo if (bodyObject && bodyObject.Records && bodyObject.Records[0] && bodyObject.Records[0].s3 && bodyObject.Records[0].s3.object && bodyObject.Records[0].s3.object.key) { - key = bodyObject.Records[0].s3.object.key + key = decodeURIComponent(bodyObject.Records[0].s3.object.key) } } // Poll only bookmark messages for now and delete notifications with other records if (key.indexOf(prefix) === 0) { let contentMessage = { - Key: `${decodeURIComponent(key)}` + Key: key } currentContent.push(contentMessage) }