Skip to content

Commit 9b31d73

Browse files
committed
Merge pull request #65 from ryanplasma/fix-username-with-at-sign
Replace @'s in usernames so the JQL query can be run
2 parents 587154c + d1ab5a7 commit 9b31d73

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
@@ -896,6 +896,9 @@ var JiraApi = exports.JiraApi = function(protocol, host, port, username, passwor
896896
// [Jira Doc](http://docs.atlassian.com/jira/REST/latest/#id296043)
897897
//
898898
this.getUsersIssues = function(username, open, callback) {
899+
if (username.indexOf("@") > -1) {
900+
username = username.replace("@", '\\u0040');
901+
}
899902
var jql = "assignee = " + username;
900903
var openText = ' AND status in (Open, "In Progress", Reopened)';
901904
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)