fix: shorter than 6 character invite codes

Fixes ZDEV-108
This commit is contained in:
Dragory 2024-01-27 15:05:35 +02:00
parent 008ac1bec0
commit 2ce5082018
No known key found for this signature in database

View file

@ -557,11 +557,12 @@ export function getUrlsInString(str: string, onlyUnique = false): MatchedURL[] {
} }
export function parseInviteCodeInput(str: string): string { export function parseInviteCodeInput(str: string): string {
if (str.match(/^[a-z0-9]{6,}$/i)) { const parsedInviteCodes = getInviteCodesInString(str);
return str; if (parsedInviteCodes.length) {
return parsedInviteCodes[0];
} }
return getInviteCodesInString(str)[0]; return str;
} }
export function isNotNull<T>(value: T): value is Exclude<T, null | undefined> { export function isNotNull<T>(value: T): value is Exclude<T, null | undefined> {