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 8b28b1752de719e2525395469771ab0cf625690c..dcf8230b3ebe573b6b37246c1ffb29f91f481ca3 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