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 6a103f24c fix: preserve custom property whitespace (#7304)
6a103f24c is described below

commit 6a103f24cac2d16801ab8a095d264a6115ddd88e
Author: Uğur Tafralı <[email protected]>
AuthorDate: Mon Oct 26 11:38:01 2026 +0300

    fix: preserve custom property whitespace (#7304)
    
    * fix: preserve custom property whitespace
    Custom property values were being trimmed of all whitespace, which corrupts 
data when users intentionally include leading/trailing spaces or full-width 
spaces. The fix only trims values that are entirely whitespace, preserving the 
original otherwise.
---
 web/src/utils/messagePayloadPreview.test.ts | 13 +++++++++++++
 web/src/utils/messagePayloadPreview.ts      |  3 ++-
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/web/src/utils/messagePayloadPreview.test.ts 
b/web/src/utils/messagePayloadPreview.test.ts
index 43919b942..31359c0c0 100644
--- a/web/src/utils/messagePayloadPreview.test.ts
+++ b/web/src/utils/messagePayloadPreview.test.ts
@@ -147,6 +147,19 @@ describe('messagePayloadPreview', () => {
     });
   });
 
+  it('preserves nonblank form property values verbatim without trimming 
whitespace', () => {
+    const result = buildMessagePropertiesFromRows([
+      { key: 'tenant', value: '  tenant-blue  ' },
+      { key: 'env', value: ' prod ' },
+    ]);
+
+    expect(result.entries.map((entry) => [entry.key, entry.value])).toEqual([
+      ['tenant', '  tenant-blue  '],
+      ['env', ' prod '],
+    ]);
+    expect(result.issues).toEqual([]);
+  });
+
   it('ignores sparse form property rows emitted by dynamic form lists', () => {
     const result = buildMessagePropertiesFromRows([
       undefined as unknown as { key?: string; value?: string },
diff --git a/web/src/utils/messagePayloadPreview.ts 
b/web/src/utils/messagePayloadPreview.ts
index 6090f062e..b6dd4b278 100644
--- a/web/src/utils/messagePayloadPreview.ts
+++ b/web/src/utils/messagePayloadPreview.ts
@@ -171,7 +171,8 @@ export const buildMessagePropertiesFromRows = (
     const rawKey = row.key ?? '';
     const rawValue = row.value ?? '';
     const key = rawKey.trim();
-    const value = rawValue.trim();
+    const trimmedValue = rawValue.trim();
+    const value = trimmedValue.length === 0 ? trimmedValue : rawValue;
 
     if (!key && !value) return;
     if (!key) {

Reply via email to