luci-base: fix "null" text appearing in modal
authorAndy Chiang <redacted>
Mon, 11 May 2026 06:52:21 +0000 (13:52 +0700)
committerFlorian Eckert <redacted>
Wed, 13 May 2026 09:33:22 +0000 (11:33 +0200)
fix "null" text appearing in modal

UPDATE: added {} in for-loop for readability - CK

Signed-off-by: Andy Chiang <redacted>
modules/luci-base/htdocs/luci-static/resources/luci.js
modules/luci-base/htdocs/luci-static/resources/ui.js

index 5649d07e77b763a776f4bf925d5aa3fe54b498eb..68852e47b6aa56be524d9f03b1b99fd233483162 100644 (file)
                                return null;
 
                        if (Array.isArray(children)) {
-                               for (let i = 0; i < children.length; i++)
+                               for (let i = 0; i < children.length; i++) {
                                        if (this.elem(children[i]))
                                                node.appendChild(children[i]);
-                                       else if (children !== null && children !== undefined)
+                                       else if (children[i] !== null && children[i] !== undefined)
                                                node.appendChild(document.createTextNode(`${children[i]}`));
+                               }
 
                                return node.lastChild;
                        }
index 2952ffe0cd2063707ccb46ec5caf1696d780d718..b21b365d7be14da0955e0c0294d03dfc1f6ee927 100644 (file)
@@ -4993,7 +4993,7 @@ const UI = baseclass.extend(/** @lends LuCI.ui.prototype */ {
                                                                if (info)
                                                                        infoNode = E('p', _('%s').format(info));
 
-                                                               UI.prototype.showModal(_('Uploading file…'), [ progress, infoNode ? infoNode : null ]);
+                                                               UI.prototype.showModal(_('Uploading file…'), [ progress, infoNode ]);
 
                                                                const data = new FormData();
 
git clone https://git.99rst.org/PROJECT