luci-base: uci.js: fix variable clash
authorJo-Philipp Wich <jo@mein.io>
Mon, 13 Apr 2020 10:22:13 +0000 (12:22 +0200)
committerJo-Philipp Wich <jo@mein.io>
Mon, 13 Apr 2020 10:22:13 +0000 (12:22 +0200)
Don't overwrite the `r` variable which is supposed to refer to the reordered
uci sections with temporary data for collecting uci add parameters.

Fixes stray uci/get permission errors caused by an attempt to load
nonsensical uci package names.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
modules/luci-base/htdocs/luci-static/resources/uci.js

index adec6fb88df6eb5f48c3d11d95242a230c4613ec..f97cd8e35472f4dcc530b19577bcd40b1c7088b7 100644 (file)
@@ -790,22 +790,22 @@ return baseclass.extend(/** @lends LuCI.uci.prototype */ {
                if (n)
                        for (var conf in n) {
                                for (var sid in n[conf]) {
-                                       var r = {
+                                       var p = {
                                                config: conf,
                                                values: { }
                                        };
 
                                        for (var k in n[conf][sid]) {
                                                if (k == '.type')
-                                                       r.type = n[conf][sid][k];
+                                                       p.type = n[conf][sid][k];
                                                else if (k == '.create')
-                                                       r.name = n[conf][sid][k];
+                                                       p.name = n[conf][sid][k];
                                                else if (k.charAt(0) != '.')
-                                                       r.values[k] = n[conf][sid][k];
+                                                       p.values[k] = n[conf][sid][k];
                                        }
 
                                        snew.push(n[conf][sid]);
-                                       tasks.push(self.callAdd(r.config, r.type, r.name, r.values));
+                                       tasks.push(self.callAdd(p.config, p.type, p.name, p.values));
                                }
 
                                pkgs[conf] = true;