Skip to content
Closed
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions cmd/internal/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,11 @@ func processValue(v any, isToolset bool) any {
if item.Key == "kind" {
item.Key = "type"
}
if item.Key == "description" {
if s, ok := item.Value.(string); ok {
item.Value = strings.TrimSpace(strings.ReplaceAll(s, "\n", " "))
}
Comment on lines +246 to +248
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The current implementation only handles Unix-style newlines (\n). If the input configuration uses Windows-style line endings (\r\n), the carriage return character (\r) will remain in the description string. Additionally, replacing newlines with spaces can result in multiple consecutive spaces if the original text had indentation or trailing spaces. Using strings.Fields combined with strings.Join is a more robust way to normalize the description into a single line with single spaces, as it automatically handles all types of whitespace and line endings.

Suggested change
if s, ok := item.Value.(string); ok {
item.Value = strings.TrimSpace(strings.ReplaceAll(s, "\n", " "))
}
if s, ok := item.Value.(string); ok {
item.Value = strings.Join(strings.Fields(s), " ")
}

}
// Recursive call for nested values (e.g., nested objects or lists)
item.Value = processValue(item.Value, false)
newVal[i] = item
Expand Down
4 changes: 4 additions & 0 deletions issues.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"number": 3023,
"title": "migration add \\n instead of separating lines for description"
}
Comment on lines +1 to +4
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

This file appears to be an accidental inclusion in the repository. It contains issue metadata that should typically be part of the pull request description or tracked in an external system, rather than being committed as a source file. Please remove it if it is not required for the application's functionality.