summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cdn/routes/external.ts3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/cdn/routes/external.ts b/src/cdn/routes/external.ts

index 32979a59..08e6b164 100644 --- a/src/cdn/routes/external.ts +++ b/src/cdn/routes/external.ts
@@ -74,11 +74,14 @@ router.get("/resize/:url", async (req: Request, res: Response) => { let buffer, response; try { response = await fetch(url, DEFAULT_FETCH_OPTIONS); + if (response.status !== 200) throw "e"; // lol super gross buffer = await response.buffer(); } catch (e) { throw new HTTPError("Couldn't fetch website"); } + if (buffer.length == 0) throw new HTTPError("Website response was empty."); + if (response.headers.get("content-type")?.indexOf("image") === -1) { throw new HTTPError("Content type is not image."); }