chore: update body regex

This commit is contained in:
Jonathan Barrow
2024-02-12 16:10:44 -05:00
parent 48a05cd437
commit bc36b7e82b
3 changed files with 3 additions and 3 deletions

View File

@@ -107,7 +107,7 @@ PostSchema.method<HydratedPostDocument>('generatePostUID', async function genera
});
PostSchema.method<HydratedPostDocument>('cleanedBody', function cleanedBody(): string {
return this.body ? this.body.replace(/[\p{L}\p{P}\d$^¨←→↑↓√¦⇒⇔¤¢€£¥™©®+×÷=±∞˘˙¸˛˜°¹²³♭♪¬¯¼½¾♡♥●◆■▲▼☆★♀♂<>]/g, '').replace(/[\n\r]+/gm, '') : '';
return this.body ? this.body.replace(/[^\p{L}\p{P}\d\n\r~$^¨¦¤¢£¥©®+×÷=±˘˙¸˛˜°¹²³¬¯¼½¾<>]/gu, '').replace(/[\n\r]+/gm, '') : '';
});
PostSchema.method<HydratedPostDocument>('cleanedMiiData', function cleanedMiiData(): string {

View File

@@ -160,7 +160,7 @@ router.post('/', upload.none(), async function (request: express.Request, respon
}
if (messageBody) {
messageBody = messageBody.replace(/[\p{L}\p{P}\d$^¨←→↑↓√¦⇒⇔¤¢€£¥™©®+×÷=±∞˘˙¸˛˜°¹²³♭♪¬¯¼½¾♡♥●◆■▲▼☆★♀♂<>]/g, '');
messageBody = messageBody.replace(/[^\p{L}\p{P}\d\n\r~$^¨¦¤¢£¥©®+×÷=±˘˙¸˛˜°¹²³¬¯¼½¾<>]/gu, '');
}
if (messageBody.length > 280) {

View File

@@ -318,7 +318,7 @@ async function newPost(request: express.Request, response: express.Response): Pr
}
if (messageBody) {
messageBody = messageBody.replace(/[\p{L}\p{P}\d$^¨←→↑↓√¦⇒⇔¤¢€£¥™©®+×÷=±∞˘˙¸˛˜°¹²³♭♪¬¯¼½¾♡♥●◆■▲▼☆★♀♂<>]/g, '');
messageBody = messageBody.replace(/[^\p{L}\p{P}\d\n\r~$^¨¦¤¢£¥©®+×÷=±˘˙¸˛˜°¹²³¬¯¼½¾<>]/gu, '');
}
if (messageBody && messageBody.length > 280) {