summary refs log tree commit diff
path: root/cdn/src
diff options
context:
space:
mode:
authorTheArcaneBrony <myrainbowdash949@gmail.com>2022-08-05 00:55:26 +0200
committerTheArcaneBrony <myrainbowdash949@gmail.com>2022-08-09 23:28:27 +0200
commit499cd2e8ff390da392263ffc5d2e34b644f6c714 (patch)
treee78f11a92e582c976de147f8707aebab705a9dbe /cdn/src
parentDo all minor updates since last commit, make another script (diff)
downloadserver-499cd2e8ff390da392263ffc5d2e34b644f6c714.tar.xz
Fix ESM error caused by file-type
Diffstat (limited to 'cdn/src')
-rw-r--r--cdn/src/routes/attachments.ts2
-rw-r--r--cdn/src/routes/avatars.ts6
-rw-r--r--cdn/src/routes/external.ts2
-rw-r--r--cdn/src/routes/role-icons.ts6
4 files changed, 8 insertions, 8 deletions
diff --git a/cdn/src/routes/attachments.ts b/cdn/src/routes/attachments.ts

index 3e04fe76..723a6c03 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.fileTypeFromBuffer(file); + const type = await FileType.fromBuffer(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 bbdf42cc..40705b2e 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.fileTypeFromBuffer(buffer); + const type = await FileType.fromBuffer(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.fileTypeFromBuffer(file); + const type = await FileType.fromBuffer(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.fileTypeFromBuffer(file); + const type = await FileType.fromBuffer(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 cf02f645..c9441fc2 100644 --- a/cdn/src/routes/external.ts +++ b/cdn/src/routes/external.ts
@@ -48,7 +48,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.fileTypeFromBuffer(file); + const result = await FileType.fromBuffer(file); res.set("Content-Type", result?.mime); diff --git a/cdn/src/routes/role-icons.ts b/cdn/src/routes/role-icons.ts
index dd96c90e..2e5c42dd 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.fileTypeFromBuffer(buffer); + const type = await FileType.fromBuffer(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.fileTypeFromBuffer(file); + const type = await FileType.fromBuffer(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.fileTypeFromBuffer(file); + const type = await FileType.fromBuffer(file); res.set("Content-Type", type?.mime); res.set("Cache-Control", "public, max-age=31536000, must-revalidate");