Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 3ccf1c6

Browse files
author
vikasrohit
authoredMay 16, 2019
Merge pull request #124 from maxceem/feature/fix-es-query-escaping
properly quote and escape query to member service
2 parents 9258b81 + 0680ba7 commit 3ccf1c6

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed
 

‎connect/service.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ const getUsersById = (ids) => {
166166
* @return {Promise} resolves to the list of user details
167167
*/
168168
const getUsersByHandle = (handles) => {
169-
const query = _.map(handles, (handle) => 'handle:' + handle).join(' OR ');
169+
const query = _.map(handles, (handle) => 'handle:"' + handle.trim().replace('"', '\\"') + '"').join(' OR ');
170170
return M2m.getMachineToken(config.AUTH0_CLIENT_ID, config.AUTH0_CLIENT_SECRET)
171171
.catch((err) => {
172172
err.message = 'Error generating m2m token: ' + err.message;

‎src/common/tcApiHelper.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ function* getUsersByHandles(handles) {
8383
return [];
8484
}
8585
// use 'OR' to link the handle matches
86-
const query = _.map(handles, (h) => 'handle:"' + h.trim() + '"').join(' OR ');
86+
const query = _.map(handles, (h) => 'handle:"' + h.trim().replace('"', '\\"') + '"').join(' OR ');
8787
return yield searchUsersByQuery(query);
8888
}
8989

0 commit comments

Comments
 (0)
Please sign in to comment.