diff options
author | Madeline <46743919+MaddyUnderStars@users.noreply.github.com> | 2022-07-22 14:02:40 +1000 |
---|---|---|
committer | Madeline <46743919+MaddyUnderStars@users.noreply.github.com> | 2022-07-22 14:02:40 +1000 |
commit | a5382fb6b598e94a8d5d55a8692290c5942652c4 (patch) | |
tree | c573e4ac3e74cfd2ff08f740883fd6649cff1149 | |
parent | Disable gateway status until I get some like child process thing done (diff) | |
parent | Try catch handleFile (diff) | |
download | server-a5382fb6b598e94a8d5d55a8692290c5942652c4.tar.xz |
Merge branch 'slowcord' of github.com:MaddyUnderStars/fosscord-server into slowcord
-rw-r--r-- | slowcord/login/src/index.ts | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/slowcord/login/src/index.ts b/slowcord/login/src/index.ts index 68234e83..a17e9eaa 100644 --- a/slowcord/login/src/index.ts +++ b/slowcord/login/src/index.ts @@ -31,7 +31,7 @@ const toDataURL = async (url: string) => { const blob = await response.blob(); const buffer = Buffer.from(await blob.text()); return `data:${blob.type};base64,${buffer.toString("base64")}`; -} +}; class Discord { static getAccessToken = async (req: Request, res: Response) => { @@ -126,9 +126,14 @@ app.get("/oauth/:type", async (req, res) => { }); if (details.avatar_url) { - const avatar = await handleFile(`/avatars/${user.id}`, await toDataURL(details.avatar_url) as string); - user.avatar = avatar; - await user.save(); + try { + const avatar = await handleFile(`/avatars/${user.id}`, await toDataURL(details.avatar_url) as string); + user.avatar = avatar; + await user.save(); + } + catch (e) { + console.error(e); + } } } |