mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-01-03 14:20:33 +01:00
use validator.escape
This commit is contained in:
@@ -252,13 +252,6 @@ middleware.renderHeader = function(req, res, callback) {
|
||||
navigation: custom_header.navigation,
|
||||
allowRegistration: meta.config.allowRegistration === undefined || parseInt(meta.config.allowRegistration, 10) === 1,
|
||||
searchEnabled: plugins.hasListeners('filter:search.query')
|
||||
},
|
||||
escapeList = {
|
||||
'&': '&',
|
||||
'<': '<',
|
||||
'>': '>',
|
||||
"'": ''',
|
||||
'"': '"'
|
||||
};
|
||||
|
||||
for (var key in res.locals.config) {
|
||||
@@ -273,9 +266,7 @@ middleware.renderHeader = function(req, res, callback) {
|
||||
return tag;
|
||||
}
|
||||
|
||||
tag.content = tag.content.replace(/[&<>'"]/g, function(tag) {
|
||||
return escapeList[tag] || tag;
|
||||
});
|
||||
tag.content = validator.escape(tag.content);
|
||||
return tag;
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user