3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-07-07 19:17:19 +00:00

fix: bandaid fix for regex override merging

This commit is contained in:
Dragory 2025-05-31 21:59:14 +00:00
parent dd939895e8
commit d8fb471b07
No known key found for this signature in database
5 changed files with 15 additions and 15 deletions

View file

@ -184,16 +184,13 @@ export function inputPatternToRegExp(pattern: string) {
}
export function zRegex<T extends ZodString>(zStr: T) {
return zStr.transform((str, ctx) => {
return zStr.refine((str) => {
try {
return inputPatternToRegExp(str);
inputPatternToRegExp(str);
return true;
} catch (err) {
if (err instanceof InvalidRegexError) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: "Invalid regex",
});
return z.NEVER;
return false;
}
throw err;
}