summary refs log tree commit diff
path: root/src/cdn/routes
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
commit7faf6e75614f4c2818f4f30a0014ee97d4244bfb (patch)
tree52b925703d5eadb48c5c88bdc1150d92a3d8e152 /src/cdn/routes
parentBetter embed handling (diff)
downloadserver-7faf6e75614f4c2818f4f30a0014ee97d4244bfb.tar.xz
Slightly better embeds
Diffstat (limited to 'src/cdn/routes')
-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",