From 0a6a2f1fc5cbea81531e2c24ded46b4ecba27647 Mon Sep 17 00:00:00 2001 From: Aleksey Kolosov Date: Fri, 15 Nov 2024 10:42:55 +0300 Subject: [PATCH] luci-app-statistics: fix prepare values from list vlaues If UCI store values as a list instead of an option, conversation for the collectd configuration is not work correctly. This is due to the use of a DynamicList type element in the UI (for example, for the RRATimespans field). For this function argument val receives as array instead of a string, so no additional conversion is required. Signed-off-by: Aleksey Kolosov --- .../luci-app-statistics/root/usr/libexec/stat-genconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/applications/luci-app-statistics/root/usr/libexec/stat-genconfig b/applications/luci-app-statistics/root/usr/libexec/stat-genconfig index 130f8f387614..0d6bd6704f69 100755 --- a/applications/luci-app-statistics/root/usr/libexec/stat-genconfig +++ b/applications/luci-app-statistics/root/usr/libexec/stat-genconfig @@ -58,7 +58,7 @@ function parse_units(ustr) { const preprocess = { RRATimespans: function(val) { - return join(' ', map(split(val, /\s+/), parse_units)); + return join(' ', map(type(val) == 'array' ? val : split(val, /\s+/), parse_units)); } };