mirror of https://git.lenooby09.tech/LeNooby09/social-app.git
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Sanitize BIDI characters from display names (#1462)

authored by

Paul Frazee and committed by
GitHub
0672451d 763a5069

+3 -1
+3 -1
src/lib/strings/display-names.ts
··· 6 6 // \u2714 = ✔ 7 7 // \u2611 = ☑ 8 8 const CHECK_MARKS_RE = /[\u2705\u2713\u2714\u2611]/gu 9 + const CONTROL_CHARS_RE = 10 + /[\u0000-\u001F\u007F-\u009F\u061C\u200E\u200F\u202A-\u202E\u2066-\u2069]/g 9 11 10 12 export function sanitizeDisplayName( 11 13 str: string, ··· 15 17 return `⚠${describeModerationCause(moderation.cause, 'account').name}` 16 18 } 17 19 if (typeof str === 'string') { 18 - return str.replace(CHECK_MARKS_RE, '').trim() 20 + return str.replace(CHECK_MARKS_RE, '').replace(CONTROL_CHARS_RE, '').trim() 19 21 } 20 22 return '' 21 23 }