From: Jo-Philipp Wich Date: Wed, 18 Mar 2015 11:43:29 +0000 (+0100) Subject: luci-base: fix backslash escaping in luci.util.serialize_json() X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=6160a53ab992e998adcda7119e49096a65a7f5de;p=oweals%2Fluci.git luci-base: fix backslash escaping in luci.util.serialize_json() Signed-off-by: Jo-Philipp Wich --- diff --git a/modules/luci-base/luasrc/util.lua b/modules/luci-base/luasrc/util.lua index 8b28b1752..dcf8230b3 100644 --- a/modules/luci-base/luasrc/util.lua +++ b/modules/luci-base/luasrc/util.lua @@ -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