floralvikings / jira-connector

NodeJS Wrapper for the Jira REST API
http://floralvikings.github.io/jira-connector/
MIT License
373 stars 180 forks source link

Search Functionality and the Ampersand #247

Open mike-rivera opened 4 years ago

mike-rivera commented 4 years ago

I have a JQL which has an ampersand in the string. i.e. component = \"Research & Architecture\". If I use this in my restful API the library or underlying component uri encodes it, so when it gets to the Jira server the string looks like this 'Research %26 Architecture'. This fails the query on the server side stating that it does not exist for the field component.

I have tried the following to see if I can get it to work:

component = \"Research \& Architecture\" - Error. SyntaxError: Unexpected token & in JSON, which makes sense.

component = \"Research \& Architecture\" - "Error in the JQL Query: '\&' is an illegal JQL escape sequence. The valid escape sequences are \', \\", \t, \n, \r, \\, '\ ' and \uXXXX. (line 1, character 57)"

component = \"Research \u0026 Architecture\" - "The value 'Research %26 Architecture' does not exist for the field 'component'."

component = \"Research \u0026 Architecture\" - error. The value 'Research %26 Architecture' does not exist for the field 'component'

component = \"Research \\u0026 Architecture\" - fails on the server with, Error in the JQL Query: '\&' is an illegal JQL escape sequence. The valid escape sequences are \', \\", \t, \n, \r, \\, '\ ' and \uXXXX. (line 1, character 57)

I am unable to change the component value, since I do not own it. Is there anything else I can do so it is not encoded, to make this query work?

mike-rivera commented 4 years ago

After some research and checking stack overflow, this appears to be a limitation with the POST operation a search. Since the JIRA api supports GET on a search. This appears to be a case where a GET operation on a search, would serve as a good alternative.

https://stackoverflow.com/questions/61190145/jira-rest-api-and-ampersand/61210126#61210126