summary refs log tree commit diff
path: root/src/cdn/routes/attachments.ts
diff options
context:
space:
mode:
authorMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2023-01-20 18:10:47 +1100
committerGitHub <noreply@github.com>2023-01-20 18:10:47 +1100
commit084dc0be08555891cad4c2bb984822a62ec5ec9f (patch)
treeed2ca0fafefa2224ae32761f955f63935422a97d /src/cdn/routes/attachments.ts
parentfix: route file regex (#956) (diff)
downloadserver-084dc0be08555891cad4c2bb984822a62ec5ec9f.tar.xz
Add ESLint (#941)
* Add eslint, switch to lint-staged for precommit

* Fix all ESLint errors

* Update GH workflow to check prettier and eslint
Diffstat (limited to 'src/cdn/routes/attachments.ts')
-rw-r--r--src/cdn/routes/attachments.ts10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/cdn/routes/attachments.ts b/src/cdn/routes/attachments.ts

index 76824925..d7764bd7 100644 --- a/src/cdn/routes/attachments.ts +++ b/src/cdn/routes/attachments.ts
@@ -41,7 +41,7 @@ router.post( throw new HTTPError("Invalid request signature"); if (!req.file) throw new HTTPError("file missing"); - const { buffer, mimetype, size, originalname, fieldname } = req.file; + const { buffer, mimetype, size, originalname } = req.file; const { channel_id } = req.params; const filename = originalname .replaceAll(" ", "_") @@ -53,8 +53,8 @@ router.post( Config.get()?.cdn.endpointPublic || "http://localhost:3003"; await storage.set(path, buffer); - var width; - var height; + let width; + let height; if (mimetype.includes("image")) { const dimensions = imageSize(buffer); if (dimensions) { @@ -81,10 +81,10 @@ router.get( "/:channel_id/:id/:filename", async (req: Request, res: Response) => { const { channel_id, id, filename } = req.params; - const { format } = req.query; + // const { format } = req.query; const path = `attachments/${channel_id}/${id}/${filename}`; - let file = await storage.get(path); + const file = await storage.get(path); if (!file) throw new HTTPError("File not found"); const type = await FileType.fromBuffer(file); let content_type = type?.mime || "application/octet-stream";