summary refs log tree commit diff
diff options
context:
space:
mode:
authorMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2022-07-22 14:02:40 +1000
committerMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2022-07-22 14:02:40 +1000
commit65143966d3ef6c09df63bf681e0bededb138c593 (patch)
tree9f8cd93f7b378c0e718421fb4d49524a67a08324
parentDisable gateway status until I get some like child process thing done (diff)
parentTry catch handleFile (diff)
downloadserver-65143966d3ef6c09df63bf681e0bededb138c593.tar.xz
Merge branch 'slowcord' of github.com:MaddyUnderStars/fosscord-server into slowcord
-rw-r--r--slowcord/login/src/index.ts13
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);
+			}
 		}
 	}