Skip to content
This repository has been archived by the owner on Jul 31, 2020. It is now read-only.

Handled a situation where user has more than one backslash in id #278

Merged
merged 1 commit into from
Feb 3, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions client/requestUtil.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
})
}

Expand Down
4 changes: 2 additions & 2 deletions lib/s3Helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down