Check db url before attempting to get a user id.

This commit is contained in:
Eric van der Vlist 2023-04-15 17:29:50 +02:00
parent 09e82600aa
commit b38fdf49ad
1 changed files with 6 additions and 2 deletions

View File

@ -32,5 +32,9 @@ export const parseDbUrl = (urlString: string) => {
return { username: hex2a(encodedUser), database: urlString }; return { username: hex2a(encodedUser), database: urlString };
}; };
export const dbUrlToUserId = (urlString: string) => export const dbUrlToUserId = (urlString: string) => {
userId(parseDbUrl(urlString)); if (!urlString) {
return null;
}
return userId(parseDbUrl(urlString));
};