diff --git a/cdn/src/routes/attachments.ts b/cdn/src/routes/attachments.ts
index 33801932..2aed752e 100644
--- a/cdn/src/routes/attachments.ts
+++ b/cdn/src/routes/attachments.ts
@@ -68,7 +68,7 @@ router.get(
`attachments/${channel_id}/${id}/${filename}`
);
if (!file) throw new HTTPError("File not found");
- const type = await FileType.fromBuffer(file);
+ const type = await FileType.fileTypeFromBuffer(file);
let content_type = type?.mime || "application/octet-stream";
if (SANITIZED_CONTENT_TYPE.includes(content_type)) {
diff --git a/cdn/src/routes/avatars.ts b/cdn/src/routes/avatars.ts
index 0b766144..3b521cc3 100644
--- a/cdn/src/routes/avatars.ts
+++ b/cdn/src/routes/avatars.ts
@@ -38,7 +38,7 @@ router.post(
.update(Snowflake.generate())
.digest("hex");
- const type = await FileType.fromBuffer(buffer);
+ const type = await FileType.fileTypeFromBuffer(buffer);
if (!type || !ALLOWED_MIME_TYPES.includes(type.mime))
throw new HTTPError("Invalid file type");
if (ANIMATED_MIME_TYPES.includes(type.mime)) hash = `a_${hash}`; // animated icons have a_ infront of the hash
@@ -65,7 +65,7 @@ router.get("/:user_id", async (req: Request, res: Response) => {
const file = await storage.get(path);
if (!file) throw new HTTPError("not found", 404);
- const type = await FileType.fromBuffer(file);
+ const type = await FileType.fileTypeFromBuffer(file);
res.set("Content-Type", type?.mime);
res.set("Cache-Control", "public, max-age=31536000");
@@ -80,7 +80,7 @@ router.get("/:user_id/:hash", async (req: Request, res: Response) => {
const file = await storage.get(path);
if (!file) throw new HTTPError("not found", 404);
- const type = await FileType.fromBuffer(file);
+ const type = await FileType.fileTypeFromBuffer(file);
res.set("Content-Type", type?.mime);
res.set("Cache-Control", "public, max-age=31536000");
diff --git a/cdn/src/routes/external.ts b/cdn/src/routes/external.ts
index dc90e3c8..ed44c905 100644
--- a/cdn/src/routes/external.ts
+++ b/cdn/src/routes/external.ts
@@ -49,7 +49,7 @@ router.get("/:id", async (req: Request, res: Response) => {
const file = await storage.get(`/external/${id}`);
if (!file) throw new HTTPError("File not found");
- const result = await FileType.fromBuffer(file);
+ const result = await FileType.fileTypeFromBuffer(file);
res.set("Content-Type", result?.mime);
diff --git a/cdn/src/routes/role-icons.ts b/cdn/src/routes/role-icons.ts
index 1d92d638..a850db88 100644
--- a/cdn/src/routes/role-icons.ts
+++ b/cdn/src/routes/role-icons.ts
@@ -38,7 +38,7 @@ router.post(
.update(Snowflake.generate())
.digest("hex");
- const type = await FileType.fromBuffer(buffer);
+ const type = await FileType.fileTypeFromBuffer(buffer);
if (!type || !ALLOWED_MIME_TYPES.includes(type.mime))
throw new HTTPError("Invalid file type");
@@ -64,7 +64,7 @@ router.get("/:role_id", async (req: Request, res: Response) => {
const file = await storage.get(path);
if (!file) throw new HTTPError("not found", 404);
- const type = await FileType.fromBuffer(file);
+ const type = await FileType.fileTypeFromBuffer(file);
res.set("Content-Type", type?.mime);
res.set("Cache-Control", "public, max-age=31536000, must-revalidate");
@@ -79,7 +79,7 @@ router.get("/:role_id/:hash", async (req: Request, res: Response) => {
const file = await storage.get(path);
if (!file) throw new HTTPError("not found", 404);
- const type = await FileType.fromBuffer(file);
+ const type = await FileType.fileTypeFromBuffer(file);
res.set("Content-Type", type?.mime);
res.set("Cache-Control", "public, max-age=31536000, must-revalidate");
|