fix: support multiline text in --field for textarea custom fields#42
fix: support multiline text in --field for textarea custom fields#42
Conversation
The --field flag truncated textarea values at the first newline because literal \n from shell double-quotes was passed through as two characters. TextToADF expects actual newlines to split paragraphs. Unescape literal \n sequences before passing to TextToADF, so `--field "Kontext=line1\n\nline2"` produces two paragraphs instead of one.
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request resolves an issue where multiline text provided through the Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request adds support for multiline text from the --field flag by unescaping \n sequences. While this is a useful feature, the current implementation using strings.ReplaceAll is a bit too aggressive and can lead to unintended data modification. For example, a Windows path like C:\Users\normal or any text containing a literal \n would be incorrectly altered. I've added a comment with a suggestion for a more robust implementation that handles escaped backslashes, allowing users to intentionally write newlines (\n) and literal backslashes (\\).
Support \\ for literal backslashes so that content like Windows paths
(C:\Users\normal) or code snippets (printf("hello\n")) can be
represented correctly by escaping: C:\\Users\\normal, printf("hello\\n").
Uses placeholder-based replacement chain to avoid double-processing.
Merging this branch will decrease overall coverage
Coverage by fileChanged files (no unit tests)
Please note that the "Total", "Covered", and "Missed" counts above refer to code statements instead of lines of code. The value in brackets refers to the test coverage of that file in the old version of the code. |
Summary
--fieldflag truncated textarea values at the first newline because literal\nfrom shell double-quotes was passed through as two charactersTextToADFexpects actual newlines to split into paragraphs\nsequences before passing toTextToADFBefore
After
Also enables
+++expand sections from--field:atl issue edit NX-15361 --field "Kontext=+++Expand title\nContent here\n+++"One-liner change in
internal/cmd/issue/field_util.go.