From 1470ed902a5edc422cc437bfe5937f3605f1bbb4 Mon Sep 17 00:00:00 2001 From: Katherine Date: Fri, 21 Mar 2025 13:17:00 +0800 Subject: [PATCH] fix: map block key management issue causing request failures due to invisible characters (#6521) --- .../plugin-map/src/client/components/Configuration.tsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/plugins/@nocobase/plugin-map/src/client/components/Configuration.tsx b/packages/plugins/@nocobase/plugin-map/src/client/components/Configuration.tsx index 9eacc129160..ab8af6f8bb1 100644 --- a/packages/plugins/@nocobase/plugin-map/src/client/components/Configuration.tsx +++ b/packages/plugins/@nocobase/plugin-map/src/client/components/Configuration.tsx @@ -32,11 +32,19 @@ const BaseConfiguration: React.FC = ({ type, children }) return apiClient.resource(MapConfigurationResourceKey); }, [apiClient]); + function removeInvisibleCharsFromObject(obj: Record): Record { + const cleanObj: Record = {}; + for (const [key, value] of Object.entries(obj)) { + cleanObj[key] = typeof value === 'string' ? value.replace(/[\p{C}\p{Z}\p{Zl}\p{Zp}]+/gu, '') : value; + } + return cleanObj; + } + const onSubmit = async (values) => { await form.validateFields(); resource .set({ - ...values, + ...removeInvisibleCharsFromObject(values), type, }) .then((res) => {