From 36f948affcd12dcc60af3d683cce5d3fb9a91a02 Mon Sep 17 00:00:00 2001 From: Chuck Date: Thu, 8 Jan 2026 15:30:42 -0500 Subject: [PATCH] fix: Make _data field matching more specific to prevent false positives Fix overly broad condition that matched any field containing '_data', causing false positives and inconsistent key transformation. Problem: - Condition 'key.endsWith('_data') || key.includes('_data')' matches any field containing '_data' anywhere (e.g., 'meta_data_field', 'custom_data_config') - key.replace(/_data$/, '') only removes '_data' from end, making logic inconsistent - Fields with '_data' in middle get matched but key isn't transformed - If their value happens to be valid JSON, it gets incorrectly parsed Solution: - Remove 'key.includes('_data')' clause - Only check 'key.endsWith('_data')' to match actual _data suffix pattern - Ensures consistent matching: only fields ending with '_data' are treated as JSON data fields, and only those get the suffix removed - Prevents false positives on fields like 'meta_data_field' that happen to contain '_data' in their name --- web_interface/static/v3/plugins_manager.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/web_interface/static/v3/plugins_manager.js b/web_interface/static/v3/plugins_manager.js index 0b5d4bb5..4c1c1c2d 100644 --- a/web_interface/static/v3/plugins_manager.js +++ b/web_interface/static/v3/plugins_manager.js @@ -2223,7 +2223,8 @@ function handlePluginConfigSubmit(e) { // Process form data with type conversion (using dot notation for nested fields) for (const [key, value] of formData.entries()) { // Check if this is a patternProperties or array-of-objects hidden input (contains JSON data) - if (key.endsWith('_data') || key.includes('_data')) { + // Only match keys ending with '_data' to avoid false positives like 'meta_data_field' + if (key.endsWith('_data')) { try { const baseKey = key.replace(/_data$/, ''); const jsonValue = JSON.parse(value);