luci-base: fix escaping lua string to js repr
authorYousong Zhou <yszhou4tech@gmail.com>
Wed, 25 Nov 2015 14:39:27 +0000 (22:39 +0800)
committerYousong Zhou <yszhou4tech@gmail.com>
Wed, 2 Dec 2015 12:56:08 +0000 (20:56 +0800)
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
modules/luci-base/luasrc/view/cbi/value.htm

index 8a08e08f2f4530364e46b6468424aa846b89e05e..c43dab5f4b49373a6368686d6f812f28afd48091 100644 (file)
@@ -29,7 +29,7 @@
                <%- end -%>');
                <%- end %>
                <% if self.datatype then -%>
-               cbi_validate_field('<%=cbid%>', <%=tostring((self.optional or self.rmempty) == true)%>, '<%=self.datatype:gsub("'", "\\'")%>');
+               cbi_validate_field('<%=cbid%>', <%=tostring((self.optional or self.rmempty) == true)%>, '<%=self.datatype:gsub("\\", "\\\\"):gsub("'", "\\'")%>');
                <%- end %>
        //]]></script>
        <% end -%>