Skip to content

Commit

Permalink
fix(ui): use xregexp to validate (#4673)
Browse files Browse the repository at this point in the history
Fixes #4669
  • Loading branch information
sogehige committed Mar 16, 2021
1 parent a2a1f3a commit f12a267
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/panel/views/managers/keyword.vue
Expand Up @@ -419,6 +419,7 @@ import { isNil, orderBy } from 'lodash-es';
import { v4 as uuid } from 'uuid';
import { validationMixin } from 'vuelidate';
import { minLength, required } from 'vuelidate/lib/validators';
import XRegExp from 'xregexp';
import type { KeywordInterface } from 'src/bot/database/entity/keyword';
import type { PermissionsInterface } from 'src/bot/database/entity/permissions';
Expand All @@ -437,9 +438,10 @@ const socket = {
} as const;
const isValidRegex = (val: string) => {
try {
new RegExp(val);
XRegExp(val);
return true;
} catch (e) {
error(e);
return false;
}
};
Expand Down

0 comments on commit f12a267

Please sign in to comment.