RockteMQ-AI commented on code in PR #2758:
URL:
https://github.com/apache/rocketmq-dashboard/pull/2758#discussion_r3886977686
##########
web/src/utils/download.ts:
##########
@@ -37,7 +37,10 @@ export interface CsvColumn<T> {
export const escapeCsvCell = (value: unknown) => {
const text = value == null ? '' : String(value);
- const formulaSafeText = /^[=+\-@\t\r\n]/.test(text) ? `'${text}` : text;
+ // Prefix both formulas and literal apostrophe-prefixed formulas. The
importer removes
+ // exactly one protection apostrophe, so any apostrophes supplied by the
user survive a
+ // complete export/import round trip.
+ const formulaSafeText = /^(?:[=+\-@\t\r\n]|'+[=+\-@\t\r\n])/.test(text) ?
`'${text}` : text;
Review Comment:
**[Info]** The regex `'+[=+\-@\t\r\n]` correctly handles apostrophe-prefixed
formulas. Consider adding a brief inline comment explaining that the importer
removes exactly one protection apostrophe, so user-provided apostrophes survive
a round trip. The existing comment on line 40-41 covers the export side well,
but the symmetry with the import side is the key insight.
--
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]