diff options
Diffstat (limited to 'src/cdn/routes/avatars.ts')
-rw-r--r-- | src/cdn/routes/avatars.ts | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/cdn/routes/avatars.ts b/src/cdn/routes/avatars.ts index e2d80d11..2c078c29 100644 --- a/src/cdn/routes/avatars.ts +++ b/src/cdn/routes/avatars.ts @@ -48,10 +48,10 @@ router.post( if (req.headers.signature !== Config.get().security.requestSignature) throw new HTTPError("Invalid request signature"); if (!req.file) throw new HTTPError("Missing file"); - const { buffer, mimetype, size, originalname, fieldname } = req.file; + const { buffer, size } = req.file; const { user_id } = req.params; - var hash = crypto + let hash = crypto .createHash("md5") .update(Snowflake.generate()) .digest("hex"); @@ -77,7 +77,7 @@ router.post( ); router.get("/:user_id", async (req: Request, res: Response) => { - var { user_id } = req.params; + let { user_id } = req.params; user_id = user_id.split(".")[0]; // remove .file extension const path = `avatars/${user_id}`; @@ -92,7 +92,8 @@ router.get("/:user_id", async (req: Request, res: Response) => { }); export const getAvatar = async (req: Request, res: Response) => { - var { user_id, hash } = req.params; + const { user_id } = req.params; + let { hash } = req.params; hash = hash.split(".")[0]; // remove .file extension const path = `avatars/${user_id}/${hash}`; |