Skip to content

Conversation

@wbh1
Copy link
Contributor

@wbh1 wbh1 commented Dec 18, 2025

Custom field array values can now contain commas by escaping them with a backslash (,). Previously, values like "WL: Tools, Development and Support" would be incorrectly split into multiple array elements.

For example, jira issue create --custom work-category='WL: Tools, Development and Support' ... would get split into WL: Tools and Development and Support, so I'd get an error back from my Jira saying that those don't exist as valid options for that multi-select field.

Changes:

  • Added splitUnescapedCommas() function to handle escaped commas
  • Updated constructCustomFields() in create.go
  • Updated constructCustomFieldsForEdit() in edit.go
  • Added test coverage for both create and edit operations

Custom field array values can now contain commas by escaping them
with a backslash (\,). Previously, values like "WL: Tools, Development
and Support" would be incorrectly split into multiple array elements.

Changes:
- Added splitUnescapedCommas() function to handle escaped commas
- Updated constructCustomFields() in create.go
- Updated constructCustomFieldsForEdit() in edit.go
- Added comprehensive test coverage for both create and edit operations

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
Copilot AI review requested due to automatic review settings December 18, 2025 18:05
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a bug where commas within custom field array values were incorrectly treated as delimiters, causing single values containing commas to be split into multiple array elements. The fix introduces a new splitUnescapedCommas() function that properly handles escaped commas (\,), allowing users to include literal commas in their values.

  • Implemented splitUnescapedCommas() to parse comma-separated values while respecting escaped commas
  • Updated both create and edit flows to use the new splitting logic
  • Added comprehensive test coverage for the escaped comma behavior

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
pkg/jira/customfield.go Adds the splitUnescapedCommas() function to handle escaped commas in array values
pkg/jira/create.go Updates constructCustomFields() to use the new splitting function
pkg/jira/edit.go Updates constructCustomFieldsForEdit() to use the new splitting function
pkg/jira/create_test.go Adds tests for escaped commas in create operations with single and multiple values
pkg/jira/edit_test.go Adds tests for escaped commas in edit operations with single and multiple values

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +62 to +63
current.WriteByte('\\')
current.WriteByte(s[i])
Copy link

Copilot AI Dec 18, 2025

Choose a reason for hiding this comment

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

When a backslash is followed by a character other than a comma, both the backslash and the character are preserved. This behavior should be documented in the function's comment to clarify that only \, is treated as an escape sequence, while other backslash sequences like \n or \t remain literal.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant