summary refs log tree commit diff
path: root/src/cdn/routes/external.ts
diff options
context:
space:
mode:
authorMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2022-10-01 15:35:07 +1000
committerMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2022-10-01 15:59:30 +1000
commit070ce373e90399d9df2a8986e0c7728724163da7 (patch)
treec629c0f7f9cbf785c0a4b9a43a785c8f530f343b /src/cdn/routes/external.ts
parentBetter embed handling (diff)
downloadserver-070ce373e90399d9df2a8986e0c7728724163da7.tar.xz
Slightly better embeds
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",