From fefb9acf57ad11012c336e4d056b074620b87d2f Mon Sep 17 00:00:00 2001 From: Paul Donald Date: Mon, 25 Nov 2024 21:32:39 +0100 Subject: [PATCH] luci-base: form: fix sort order bug triggered by integer types Signed-off-by: Paul Donald --- modules/luci-base/htdocs/luci-static/resources/form.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/luci-base/htdocs/luci-static/resources/form.js b/modules/luci-base/htdocs/luci-static/resources/form.js index 53ea3c5bcd9..7cf2ae75971 100644 --- a/modules/luci-base/htdocs/luci-static/resources/form.js +++ b/modules/luci-base/htdocs/luci-static/resources/form.js @@ -3068,8 +3068,10 @@ var CBITableSection = CBITypedSection.extend(/** @lends LuCI.form.TableSection.p n.classList.remove('flash') }); + val = Array.isArray(val) ? val.join(' '): val; + val = `${val}`; // coerce non-string types to string list.push([ - ui.Table.prototype.deriveSortKey((val != null) ? val.trim() : ''), + ui.Table.prototype.deriveSortKey((val != null && typeof val.trim === 'function') ? val.trim() : ''), tr ]); }, this));