diff --git a/package.json b/package.json index 88373c3..16d19fb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "yohobuy-node", - "version": "6.6.12", + "version": "6.6.14", "private": true, "description": "A New Yohobuy Project With Express", "repository": { diff --git a/utils/cleanHtml.js b/utils/cleanHtml.js index 7669bce..a32e893 100644 --- a/utils/cleanHtml.js +++ b/utils/cleanHtml.js @@ -10,7 +10,7 @@ const htmlEntity = { }; exports.htmlDecode = function(txt) { - txt = txt || ''; + txt = txt + '' || ''; return txt.replace(/((&(([a-z][a-z0-9]*)|(#[0-9]+)|(#x[0-9a-f]+));)|["'<>&])/gi, function(s) { s = s || ''; const s1 = htmlEntity[s.toLowerCase()]; @@ -24,7 +24,8 @@ exports.htmlDecode = function(txt) { }; exports.htmlEncode = function(str) { - str = str || ''; + str = str + '' || ''; + return str.replace(re, function(s) { switch (s) { case '"': diff --git a/utils/helpers.js b/utils/helpers.js index 687e899..b98dc10 100644 --- a/utils/helpers.js +++ b/utils/helpers.js @@ -87,7 +87,7 @@ module.exports = { htmlEncode: function(str) { const re = /(\r\n)|["\'<>]/g; - str = str || ''; + str = str + '' || ''; return str.replace(re, function(s) { switch (s) { case '"':