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 8a08e08..c43dab5 100644 (file)
@@ -29,7 +29,7 @@
                <%- end -%>');
                <%- end %>
                <% if self.datatype then -%>
                <%- 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 -%>
                <%- end %>
        //]]></script>
        <% end -%>