Skip to content

Commit d1ab5a7

Browse files
author
Ryan Plas
committed
Replace @'s in usernames so the JQL query can be run
1 parent 9775af8 commit d1ab5a7

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

lib/jira.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -900,6 +900,9 @@ var JiraApi = exports.JiraApi = function(protocol, host, port, username, passwor
900900
// [Jira Doc](http://docs.atlassian.com/jira/REST/latest/#id296043)
901901
//
902902
this.getUsersIssues = function(username, open, callback) {
903+
if (username.indexOf("@") > -1) {
904+
username = username.replace("@", '\\u0040');
905+
}
903906
var jql = "assignee = " + username;
904907
var openText = ' AND status in (Open, "In Progress", Reopened)';
905908
if (open) { jql += openText; }

spec/jira.spec.coffee

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,15 @@ describe "Node Jira Tests", ->
368368
expect(@jira.searchJira).toHaveBeenCalledWith expected, {},
369369
jasmine.any(Function)
370370

371+
it "Properly Escapes @'s in Usernames", ->
372+
spyOn @jira, 'searchJira'
373+
expected = "assignee = email\\u0040example.com AND status in (Open, \"In Progress\",
374+
Reopened)"
375+
376+
@jira.getUsersIssues '[email protected]', true, @cb
377+
expect(@jira.searchJira).toHaveBeenCalledWith expected, {},
378+
jasmine.any(Function)
379+
371380
it "Gets the sprint issues and information", ->
372381
options =
373382
rejectUnauthorized: true

0 commit comments

Comments
 (0)