mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-20 23:46:14 -04:00
Create and use the Security module.
Use it to replace code on the client and server side.
This commit is contained in:
parent
363e168561
commit
e0d23e3c5d
6 changed files with 74 additions and 65 deletions
|
@ -20,6 +20,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
var Security = require('/security');
|
||||
|
||||
function isNodeText(node)
|
||||
{
|
||||
|
@ -137,14 +138,7 @@ function binarySearchInfinite(expectedLength, func)
|
|||
|
||||
function htmlPrettyEscape(str)
|
||||
{
|
||||
return str.replace(/[&"<>]/g, function (c) {
|
||||
return {
|
||||
'&': '&',
|
||||
'"': '"',
|
||||
'<': '<',
|
||||
'>': '>'
|
||||
}[c] || c;
|
||||
}).replace(/\r?\n/g, '\\n');
|
||||
return Security.escapeHTML(str).replace(/\r?\n/g, '\\n');
|
||||
}
|
||||
|
||||
exports.isNodeText = isNodeText;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue