You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by "btlqql (via GitHub)" <gi...@apache.org> on 2026/08/29 15:24:28 UTC
[PR] fix(csv): preserve literal formula apostrophes [rocketmq-dashboard]
btlqql opened a new pull request, #2758:
URL: https://github.com/apache/rocketmq-dashboard/pull/2758
## Summary
- protect formula-like CSV cells that already contain leading apostrophes
- remove exactly one export protection layer during parsing so user-provided apostrophes survive
- cover export output and a full export/import round trip
## Tests
- `npm test -- src/utils/download.test.ts src/utils/resourceCsvImport.test.ts` (17 passed)
- `npm exec eslint -- src/utils/download.ts src/utils/download.test.ts src/utils/resourceCsvImport.ts src/utils/resourceCsvImport.test.ts`
Closes #2756
--
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: commits-unsubscribe@rocketmq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix(csv): preserve literal formula apostrophes [rocketmq-dashboard]
Posted by "lizhimins (via GitHub)" <gi...@apache.org>.
lizhimins merged PR #2758:
URL: https://github.com/apache/rocketmq-dashboard/pull/2758
--
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: commits-unsubscribe@rocketmq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix(csv): preserve literal formula apostrophes [rocketmq-dashboard]
Posted by "RockteMQ-AI (via GitHub)" <gi...@apache.org>.
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: commits-unsubscribe@rocketmq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org