Merge branch 'release/0906' into 'gray'
Release/0906 See merge request !366
Showing
3 changed files
with
5 additions
and
4 deletions
@@ -10,7 +10,7 @@ const htmlEntity = { | @@ -10,7 +10,7 @@ const htmlEntity = { | ||
10 | }; | 10 | }; |
11 | 11 | ||
12 | exports.htmlDecode = function(txt) { | 12 | exports.htmlDecode = function(txt) { |
13 | - txt = txt || ''; | 13 | + txt = txt + '' || ''; |
14 | return txt.replace(/((&(([a-z][a-z0-9]*)|(#[0-9]+)|(#x[0-9a-f]+));)|["'<>&])/gi, function(s) { | 14 | return txt.replace(/((&(([a-z][a-z0-9]*)|(#[0-9]+)|(#x[0-9a-f]+));)|["'<>&])/gi, function(s) { |
15 | s = s || ''; | 15 | s = s || ''; |
16 | const s1 = htmlEntity[s.toLowerCase()]; | 16 | const s1 = htmlEntity[s.toLowerCase()]; |
@@ -24,7 +24,8 @@ exports.htmlDecode = function(txt) { | @@ -24,7 +24,8 @@ exports.htmlDecode = function(txt) { | ||
24 | }; | 24 | }; |
25 | 25 | ||
26 | exports.htmlEncode = function(str) { | 26 | exports.htmlEncode = function(str) { |
27 | - str = str || ''; | 27 | + str = str + '' || ''; |
28 | + | ||
28 | return str.replace(re, function(s) { | 29 | return str.replace(re, function(s) { |
29 | switch (s) { | 30 | switch (s) { |
30 | case '"': | 31 | case '"': |
@@ -87,7 +87,7 @@ module.exports = { | @@ -87,7 +87,7 @@ module.exports = { | ||
87 | htmlEncode: function(str) { | 87 | htmlEncode: function(str) { |
88 | const re = /(\r\n)|["\'<>]/g; | 88 | const re = /(\r\n)|["\'<>]/g; |
89 | 89 | ||
90 | - str = str || ''; | 90 | + str = str + '' || ''; |
91 | return str.replace(re, function(s) { | 91 | return str.replace(re, function(s) { |
92 | switch (s) { | 92 | switch (s) { |
93 | case '"': | 93 | case '"': |
-
Please register or login to post a comment