Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix(validator): 🐛 fix isUUIDv4() regex to include lowercase letters. … #424

Merged
merged 3 commits into from
Oct 22, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/options/validator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ export const typeGuards = <const>{
const hyphenatedRegex = /^[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i;
const nonHyphenatedRegex = /^[0-9A-F]{8}[0-9A-F]{4}4[0-9A-F]{3}[89AB][0-9A-F]{3}[0-9A-F]{12}$/i;

return (typeof value === 'string') && [hyphenatedRegex, nonHyphenatedRegex].some(regex => regex.test(value));
return (typeof value === 'string') && [hyphenatedRegex, nonHyphenatedRegex].some(regex => regex.test(value.toUpperCase()));
},
};

Expand All @@ -322,7 +322,7 @@ export class TimeZoneField extends InputFieldValidator {
public constructor(elementId: string) {
super(elementId, typeGuardModifiers.isNullable(typeGuards.isTimeZoneRequest), 'a timezone');
}

protected override async validator(inputValue: NullIfEmpty<string>): Promise<NullIfEmpty<string> | typeof InputFieldValidator.INVALID_INPUT> {
if (await super.validator(inputValue) !== inputValue) {
this.addInvalidError('Invalid time zone.');
Expand Down
Loading