merge: fix: Replace RE2 with RegExp for "mute word" regex validation (resolves #850) (!836)

View MR for information: https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/836

Closes #850

Approved-by: dakkar <dakkar@thenautilus.net>
Approved-by: Hazelnoot <acomputerdog@gmail.com>
This commit is contained in:
Hazelnoot 2024-12-26 19:09:49 +00:00
commit 4b6a338e0d

View file

@ -3,7 +3,6 @@
* SPDX-License-Identifier: AGPL-3.0-only
*/
import RE2 from 're2';
import * as mfm from '@transfem-org/sfm-js';
import { Inject, Injectable } from '@nestjs/common';
import ms from 'ms';
@ -325,7 +324,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
if (!regexp) throw new ApiError(meta.errors.invalidRegexp);
try {
new RE2(regexp[1], regexp[2]);
new RegExp(regexp[1], regexp[2]);
} catch (err) {
throw new ApiError(meta.errors.invalidRegexp);
}