Skip to content

Commit 255c4b9

Browse files
committed
fix: unable to link discord if user has no avatar
1 parent 9287e88 commit 255c4b9

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

backend/src/utils/discord.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ const BASE_URL = "https://discord.com/api";
1010

1111
const DiscordIdAndAvatarSchema = z.object({
1212
id: z.string(),
13-
avatar: z.string().optional(),
13+
avatar: z
14+
.string()
15+
.optional()
16+
.or(z.null().transform(() => undefined)),
1417
});
1518
type DiscordIdAndAvatar = z.infer<typeof DiscordIdAndAvatarSchema>;
1619

0 commit comments

Comments
 (0)