luci-base: fix backslash escaping in luci.util.serialize_json()
authorJo-Philipp Wich <jow@openwrt.org>
Wed, 18 Mar 2015 11:43:29 +0000 (12:43 +0100)
committerJo-Philipp Wich <jow@openwrt.org>
Wed, 18 Mar 2015 11:43:29 +0000 (12:43 +0100)
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
modules/luci-base/luasrc/util.lua

index 8b28b17..dcf8230 100644 (file)
@@ -643,7 +643,7 @@ function serialize_json(x, cb)
                        push(tostring(x))
                end
        else
-               push('"%s"' % tostring(x):gsub('["%z\1-\31]',
+               push('"%s"' % tostring(x):gsub('["%z\1-\31\\]',
                        function(c) return '\\u%04x' % c:byte(1) end))
        end