kopia lustrzana https://github.com/c9/core
fix escaping of uppercase script tags in JSONToJS
rodzic
8a88de1656
commit
a2db60bed8
|
@ -7,7 +7,7 @@ module.exports = function(options, imports, register) {
|
||||||
imports["connect.render"].registerEngine("ejs", createView);
|
imports["connect.render"].registerEngine("ejs", createView);
|
||||||
|
|
||||||
ejs.filters.JSONToJS = function(obj, indent) {
|
ejs.filters.JSONToJS = function(obj, indent) {
|
||||||
return JSON.stringify(obj, null, indent).replace(/<\/?script|[\u2028\u2029]/g, function(a) {
|
return JSON.stringify(obj, null, indent).replace(/<\/?script|[\u2028\u2029]/ig, function(a) {
|
||||||
var h = a.charCodeAt(0).toString(16);
|
var h = a.charCodeAt(0).toString(16);
|
||||||
return (h.length == 2 ? "\\x" : "\\u") + h + a.substr(1);
|
return (h.length == 2 ? "\\x" : "\\u") + h + a.substr(1);
|
||||||
});
|
});
|
||||||
|
|
Ładowanie…
Reference in New Issue