|
|
@ -1,13 +1,9 @@ |
|
|
|
// html encode string
|
|
|
|
// html encode string
|
|
|
|
const encode = (str) => { |
|
|
|
const encode = (str: string) => { |
|
|
|
const buf = []; |
|
|
|
return str |
|
|
|
|
|
|
|
?.split('') |
|
|
|
for (let i = str.length - 1; i >= 0; i--) { |
|
|
|
.map((char) => `&#${char.charCodeAt(0)};`) |
|
|
|
const encoded = ['&#', str[i].charCodeAt(), ';'].join(''); |
|
|
|
.join(''); |
|
|
|
buf.unshift(encoded); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return buf.join(''); |
|
|
|
|
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
// a method to sanitise content and avoid any link/url injection in email content and html encode special chars
|
|
|
|
// a method to sanitise content and avoid any link/url injection in email content and html encode special chars
|
|
|
|