Browse Source

refactor: simplified version of encode

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/8470/head
Pranav C 7 months ago
parent
commit
42bae93508
  1. 14
      packages/nocodb/src/utils/emailUtils.ts

14
packages/nocodb/src/utils/emailUtils.ts

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

Loading…
Cancel
Save