This is an automated email from the ASF dual-hosted git repository.
lizhimins pushed a commit to branch rocketmq-studio
in repository https://gitbox.apache.org/repos/asf/rocketmq-dashboard.git
The following commit(s) were added to refs/heads/rocketmq-studio by this push:
new b2968f6a fix(consumer): guard control-prefixed CSV formulas (#1561)
b2968f6a is described below
commit b2968f6a19491f7f22087c9e63a89c4a3c552de5
Author: 0 <[email protected]>
AuthorDate: Tue Aug 11 20:23:37 2026 +0800
fix(consumer): guard control-prefixed CSV formulas (#1561)
---
web/src/pages/instance/__tests__/ConsumerPage.test.tsx | 3 ++-
web/src/pages/instance/consumer.tsx | 4 +++-
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/web/src/pages/instance/__tests__/ConsumerPage.test.tsx
b/web/src/pages/instance/__tests__/ConsumerPage.test.tsx
index 951b30ef..c3f2262b 100644
--- a/web/src/pages/instance/__tests__/ConsumerPage.test.tsx
+++ b/web/src/pages/instance/__tests__/ConsumerPage.test.tsx
@@ -195,7 +195,7 @@ describe('Consumer page', () => {
{
...group,
name: 'orders-cg',
- namespace: 'trade',
+ namespace: '\r=formula-risk',
subscribedTopics: ['orders-topic', 'payments,topic'],
},
{
@@ -222,6 +222,7 @@ describe('Consumer page', () => {
expect(exportedBlob).toBeDefined();
const csv = await exportedBlob!.text();
expect(csv).toContain('"orders-cg"');
+ expect(csv).toContain('"\'\r=formula-risk"');
expect(csv).toContain('"orders-topic;payments,topic"');
expect(csv).not.toContain('users-cg');
clickSpy.mockRestore();
diff --git a/web/src/pages/instance/consumer.tsx
b/web/src/pages/instance/consumer.tsx
index 114264ad..2940cdd9 100644
--- a/web/src/pages/instance/consumer.tsx
+++ b/web/src/pages/instance/consumer.tsx
@@ -139,7 +139,7 @@ const GROUP_EXPORT_COLUMNS: Array<{ header: string; value:
(group: ConsumerGroup
const escapeCsvCell = (value: unknown) => {
const text = value == null ? '' : String(value);
- const formulaSafeText = /^[=+\-@]/.test(text) ? `'${text}` : text;
+ const formulaSafeText = /^[=+\-@\t\r\n]/.test(text) ? `'${text}` : text;
return `"${formulaSafeText.replace(/"/g, '""')}"`;
};
@@ -232,6 +232,7 @@ const ConsumerPage = () => {
const groupRequestIdRef = useRef(0);
useEffect(() => {
+ // eslint-disable-next-line react-hooks/set-state-in-effect -- clear state
owned by the previous instance
setSelectedGroup(null);
setModalOpen(false);
setResetGroup(null);
@@ -241,6 +242,7 @@ const ConsumerPage = () => {
useEffect(() => {
if (!selectedInstanceId) {
groupRequestIdRef.current += 1;
+ // eslint-disable-next-line react-hooks/set-state-in-effect -- clear
state when the instance scope is removed
setGroups([]);
setSelectedRowKeys([]);
setLoading(false);