Skip to content
Open
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
24 changes: 6 additions & 18 deletions utils/jira.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,15 +231,9 @@ class Jira {
*/
async findByStatus(status, maxResults = 100, fields = ['key', 'summary', 'status']) {
try {
const jql = `status = "${status}"`
const response = await this.request('/search', {
method: 'POST',
body: JSON.stringify({
jql,
fields,
maxResults
})
})
const jql = encodeURIComponent(`status = "${status}"`)
const fieldsParam = encodeURIComponent(fields.join(','))
const response = await this.request(`/search?jql=${jql}&fields=${fieldsParam}&maxResults=${maxResults}`)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Jira API Search Request Method Change

Removing the method option implicitly changes the Jira API search requests from POST to GET. This shifts parameters to the URL, introducing length limitations (typically ~2048 characters). Consequently, findByStatus and updateByPR may fail for complex JQL queries, long status names, or extensive field lists.

Additional Locations (1)

Fix in Cursor Fix in Web


const data = await response.json()
console.log(`Found ${data.issues.length} issues in "${status}" status`)
Expand Down Expand Up @@ -293,15 +287,9 @@ class Jira {
*/
async updateByPR(prUrl, newStatus, fields = {}) {
try {
let jql = `text ~ "${prUrl}"`
const response = await this.request('/search', {
method: 'POST',
body: JSON.stringify({
jql,
fields: ['key', 'summary', 'status', 'description'],
maxResults: 50
})
})
const jql = encodeURIComponent(`text ~ "${prUrl}"`)
const fieldsParam = encodeURIComponent('key,summary,status,description')
const response = await this.request(`/search?jql=${jql}&fields=${fieldsParam}&maxResults=50`)

const data = await response.json()
const issues = data.issues
Expand Down
Loading