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) }