From f7f401ba08572efe60f2272b4e5d4e633270fe6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Sch=C3=A4fer?= Date: Thu, 1 Aug 2024 11:29:57 +0200 Subject: [PATCH] Only cache sharepic when request to Github server was successful --- server/src/routes/utility.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/server/src/routes/utility.ts b/server/src/routes/utility.ts index 76bca8a..d07b274 100644 --- a/server/src/routes/utility.ts +++ b/server/src/routes/utility.ts @@ -45,7 +45,9 @@ router.get("/github-sharepic", async (req, res) => { .then((r) => { r.arrayBuffer() .then((buf) => { - cachedSharepic = { url, bytes: new Uint8Array(buf) }; + if (r.status === 200) { + cachedSharepic = { url, bytes: new Uint8Array(buf) }; + } sendCachedBytesOrNotFound(); }) .catch(sendCachedBytesOrNotFound);