diff --git a/src/componets/content/ConfigTemplate.tsx b/src/componets/content/ConfigTemplate.tsx index 28464fb..1055f3c 100644 --- a/src/componets/content/ConfigTemplate.tsx +++ b/src/componets/content/ConfigTemplate.tsx @@ -52,7 +52,13 @@ export function ConfigTemplate(props: ConfigTemplateProps) { try { if (value.trim()) { // Replace @placeholders@ with valid JSON values for validation - const sanitizedValue = value.replace(/"@?(\w+)@?"/g, '"__PLACEHOLDER__"'); + // Handle both quoted "@placeholder@" and unquoted @placeholder@ + let sanitizedValue = value + // Replace quoted placeholders: "@host@" -> "__PLACEHOLDER__" + .replace(/"@[^"]+@"/g, '"__PLACEHOLDER__"') + // Replace unquoted placeholders between : and , or } : @port@ -> "__PLACEHOLDER__" + .replace(/:\s*@[^,\s}]+@/g, ': "__PLACEHOLDER__"'); + JSON.parse(sanitizedValue); setJsonError(null); } else {