Frun1na opened a new pull request, #4661: URL: https://github.com/apache/rocketmq-dashboard/pull/4661
### Which Issue(s) This PR Fixes - Fixes #<BACKFILL> ### Brief Description The table renderer builds each row with `strings.Join(values, "\t")` and feeds it to a `tabwriter` with default flags, and `stringify` returns server-provided strings verbatim. Any cell value containing a raw tab is read as a column delimiter — every following column of that row shifts — and an embedded newline or carriage return splits the row in two or overwrites the line start on the terminal. The corruption is data-dependent and silent in table mode (JSON and YAML output are unaffected): broker descriptions, error text, client hostnames and user-supplied topic or group metadata can all carry these characters. `stringify` is only used by `Rows` (table rendering), so escaping there cannot affect the JSON or YAML output paths. The fix renders `\t`, `\n` and `\r` as their escape sequences inside cells. ### How Did You Test This Change? New test `TestRowsEscapesControlCharactersInCellValues` renders a row whose description contains tab, newline and carriage return and asserts the output is exactly one header line plus one data line with the escaped value. It fails on the pre-fix code (the embedded tab and newline produce three lines and shift the columns): ``` $ cd rmqctl && go test ./... ok github.com/apache/rocketmq-dashboard/rmqctl/cmd ok github.com/apache/rocketmq-dashboard/rmqctl/internal/catalog ok github.com/apache/rocketmq-dashboard/rmqctl/internal/catalog/generate ok github.com/apache/rocketmq-dashboard/rmqctl/internal/config ok github.com/apache/rocketmq-dashboard/rmqctl/internal/output ok github.com/apache/rocketmq-dashboard/rmqctl/internal/studio ``` - [x] Tests added or updated for non-trivial changes - [x] No new source files (no license headers needed) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
