fix: configure lxc container POST request
authorducloc464 <[email protected]>
Fri, 14 Feb 2025 11:00:16 +0000 (18:00 +0700)
committerPaul Donald <[email protected]>
Tue, 25 Feb 2025 20:07:32 +0000 (14:07 -0600)
Signed-off-by: ducloc464 <[email protected]>
applications/luci-app-lxc/luasrc/controller/lxc.lua
applications/luci-app-lxc/luasrc/view/lxc.htm

index 1682def2799e5c41b36f43cd4a31e1027c3b7676..5b603e52d91007b19beb42dc3dd218a5524e30dd 100644 (file)
@@ -140,6 +140,7 @@ function lxc_configuration_set(lxc_name)
        luci.http.prepare_content("text/plain")
 
        local lxc_configuration = luci.http.formvalue("lxc_conf")
+       lxc_configuration = luci.http.urldecode(lxc_configuration, true)
        if lxc_configuration == nil then
                util.perror("lxc error: config formvalue is empty")
                return
index 69025ad6d3927ee5ea8a293861c7ec64dca17313..e5d261c6e8a0ea190a410e15cc0dde44b28629ac 100644 (file)
@@ -250,7 +250,7 @@ local target = nx.uname().machine
                var lxc_name = textarea.dataset['id'];
                var lxc_conf = textarea.value;
 
-       new XHR().post('<%=luci.dispatcher.build_url("admin", "services")%>/lxc_configuration_set/' + lxc_name, "lxc_conf=" + encodeURIComponent(lxc_conf),
+       new XHR().post('<%=luci.dispatcher.build_url("admin", "services")%>/lxc_configuration_set/' + lxc_name, {"lxc_conf": encodeURIComponent(lxc_conf)},
                function(x)
                {
                        if (!x || x.responseText != "0")