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

index 405e665e..33528a7b 100644 --- a/src/cdn/routes/external.ts +++ b/src/cdn/routes/external.ts
@@ -77,6 +77,10 @@ router.get("/resize/:url", async (req: Request, res: Response) => { throw new HTTPError("Couldn't fetch website"); } + if (response.headers.get("content-type")?.indexOf("image") === -1) { + throw new HTTPError("Content type is not image."); + } + const resizedBuffer = await sharp(buffer) .resize(parseInt(width as string), parseInt(height as string), { fit: "inside",