diff --git a/src/cdn/routes/app-assets.ts b/src/cdn/routes/app-assets.ts index 149d8b3..0764d52 100644 --- a/src/cdn/routes/app-assets.ts +++ b/src/cdn/routes/app-assets.ts @@ -43,7 +43,7 @@ const { buffer, size } = req.file; const { guild_id } = req.params as { [key: string]: string }; - let hash = crypto.createHash("md5").update(Snowflake.generate()).digest("hex"); + let hash = crypto.createHash("md5").update(buffer).digest("hex"); const type = await fileTypeFromBuffer(buffer); if (!type || !ALLOWED_MIME_TYPES.includes(type.mime)) throw new HTTPError("Invalid file type"); diff --git a/src/cdn/routes/app-icons.ts b/src/cdn/routes/app-icons.ts index b67bc1f..300d4bd 100644 --- a/src/cdn/routes/app-icons.ts +++ b/src/cdn/routes/app-icons.ts @@ -43,7 +43,7 @@ const { buffer, size } = req.file; const { guild_id } = req.params as { [key: string]: string }; - let hash = crypto.createHash("md5").update(Snowflake.generate()).digest("hex"); + let hash = crypto.createHash("md5").update(buffer).digest("hex"); const type = await fileTypeFromBuffer(buffer); if (!type || !ALLOWED_MIME_TYPES.includes(type.mime)) throw new HTTPError("Invalid file type"); diff --git a/src/cdn/routes/avatars.ts b/src/cdn/routes/avatars.ts index f2d539b..9fc74bf 100644 --- a/src/cdn/routes/avatars.ts +++ b/src/cdn/routes/avatars.ts @@ -42,7 +42,7 @@ const { buffer, size } = req.file; const { user_id } = req.params as { [key: string]: string }; - let hash = crypto.createHash("md5").update(Snowflake.generate()).digest("hex"); + let hash = crypto.createHash("md5").update(buffer).digest("hex"); const type = await fileTypeFromBuffer(buffer); if (!type || !ALLOWED_MIME_TYPES.includes(type.mime)) throw new HTTPError("Invalid file type"); diff --git a/src/cdn/routes/banners.ts b/src/cdn/routes/banners.ts index 979bdad..89bd8bc 100644 --- a/src/cdn/routes/banners.ts +++ b/src/cdn/routes/banners.ts @@ -43,7 +43,7 @@ const { buffer, size } = req.file; const { guild_id } = req.params as { [key: string]: string }; - let hash = crypto.createHash("md5").update(Snowflake.generate()).digest("hex"); + let hash = crypto.createHash("md5").update(buffer).digest("hex"); const type = await fileTypeFromBuffer(buffer); if (!type || !ALLOWED_MIME_TYPES.includes(type.mime)) throw new HTTPError("Invalid file type"); diff --git a/src/cdn/routes/channel-icons.ts b/src/cdn/routes/channel-icons.ts index 3b85d4e..587a096 100644 --- a/src/cdn/routes/channel-icons.ts +++ b/src/cdn/routes/channel-icons.ts @@ -43,7 +43,7 @@ const { buffer, size } = req.file; const { guild_id } = req.params as { [key: string]: string }; - let hash = crypto.createHash("md5").update(Snowflake.generate()).digest("hex"); + let hash = crypto.createHash("md5").update(buffer).digest("hex"); const type = await fileTypeFromBuffer(buffer); if (!type || !ALLOWED_MIME_TYPES.includes(type.mime)) throw new HTTPError("Invalid file type"); diff --git a/src/cdn/routes/discover-splashes.ts b/src/cdn/routes/discover-splashes.ts index e9c07cb..ee6e0af 100644 --- a/src/cdn/routes/discover-splashes.ts +++ b/src/cdn/routes/discover-splashes.ts @@ -43,7 +43,7 @@ const { buffer, size } = req.file; const { guild_id } = req.params as { [key: string]: string }; - let hash = crypto.createHash("md5").update(Snowflake.generate()).digest("hex"); + let hash = crypto.createHash("md5").update(buffer).digest("hex"); const type = await fileTypeFromBuffer(buffer); if (!type || !ALLOWED_MIME_TYPES.includes(type.mime)) throw new HTTPError("Invalid file type"); diff --git a/src/cdn/routes/discovery-splashes.ts b/src/cdn/routes/discovery-splashes.ts index 9d6d81c..32dfb9b 100644 --- a/src/cdn/routes/discovery-splashes.ts +++ b/src/cdn/routes/discovery-splashes.ts @@ -43,7 +43,7 @@ const { buffer, size } = req.file; const { guild_id } = req.params as { [key: string]: string }; - let hash = crypto.createHash("md5").update(Snowflake.generate()).digest("hex"); + let hash = crypto.createHash("md5").update(buffer).digest("hex"); const type = await fileTypeFromBuffer(buffer); if (!type || !ALLOWED_MIME_TYPES.includes(type.mime)) throw new HTTPError("Invalid file type"); diff --git a/src/cdn/routes/emojis.ts b/src/cdn/routes/emojis.ts index f11af3b..074e727 100644 --- a/src/cdn/routes/emojis.ts +++ b/src/cdn/routes/emojis.ts @@ -43,7 +43,7 @@ const { buffer, size } = req.file; const { emoji_id } = req.params as { [key: string]: string }; - let hash = crypto.createHash("md5").update(Snowflake.generate()).digest("hex"); + let hash = crypto.createHash("md5").update(buffer).digest("hex"); const type = await fileTypeFromBuffer(buffer); if (!type || !ALLOWED_MIME_TYPES.includes(type.mime)) throw new HTTPError("Invalid file type"); diff --git a/src/cdn/routes/guild-profiles.ts b/src/cdn/routes/guild-profiles.ts index 9d27deb..d96a6dd 100644 --- a/src/cdn/routes/guild-profiles.ts +++ b/src/cdn/routes/guild-profiles.ts @@ -42,7 +42,7 @@ const { buffer, size } = req.file; const { guild_id, user_id } = req.params as { [key: string]: string }; - let hash = crypto.createHash("md5").update(Snowflake.generate()).digest("hex"); + let hash = crypto.createHash("md5").update(buffer).digest("hex"); const type = await fileTypeFromBuffer(buffer); if (!type || !ALLOWED_MIME_TYPES.includes(type.mime)) throw new HTTPError("Invalid file type"); diff --git a/src/cdn/routes/icons.ts b/src/cdn/routes/icons.ts index 6ddd49e..727497f 100644 --- a/src/cdn/routes/icons.ts +++ b/src/cdn/routes/icons.ts @@ -43,7 +43,7 @@ const { buffer, size } = req.file; const { guild_id } = req.params as { [key: string]: string }; - let hash = crypto.createHash("md5").update(Snowflake.generate()).digest("hex"); + let hash = crypto.createHash("md5").update(buffer).digest("hex"); const type = await fileTypeFromBuffer(buffer); if (!type || !ALLOWED_MIME_TYPES.includes(type.mime)) throw new HTTPError("Invalid file type"); diff --git a/src/cdn/routes/splashes.ts b/src/cdn/routes/splashes.ts index a10709d..44626dc 100644 --- a/src/cdn/routes/splashes.ts +++ b/src/cdn/routes/splashes.ts @@ -43,7 +43,7 @@ const { buffer, size } = req.file; const { guild_id } = req.params as { [key: string]: string }; - let hash = crypto.createHash("md5").update(Snowflake.generate()).digest("hex"); + let hash = crypto.createHash("md5").update(buffer).digest("hex"); const type = await fileTypeFromBuffer(buffer); if (!type || !ALLOWED_MIME_TYPES.includes(type.mime)) throw new HTTPError("Invalid file type"); diff --git a/src/cdn/routes/stickers.ts b/src/cdn/routes/stickers.ts index a920694..2ffa92f 100644 --- a/src/cdn/routes/stickers.ts +++ b/src/cdn/routes/stickers.ts @@ -43,7 +43,7 @@ const { buffer, size } = req.file; const { sticker_id } = req.params as { [key: string]: string }; - let hash = crypto.createHash("md5").update(Snowflake.generate()).digest("hex"); + let hash = crypto.createHash("md5").update(buffer).digest("hex"); const type = await fileTypeFromBuffer(buffer); if (!type || !ALLOWED_MIME_TYPES.includes(type.mime)) throw new HTTPError("Invalid file type"); diff --git a/src/cdn/routes/team-icons.ts b/src/cdn/routes/team-icons.ts index c0e7e78..de5f022 100644 --- a/src/cdn/routes/team-icons.ts +++ b/src/cdn/routes/team-icons.ts @@ -43,7 +43,7 @@ const { buffer, size } = req.file; const { guild_id } = req.params as { [key: string]: string }; - let hash = crypto.createHash("md5").update(Snowflake.generate()).digest("hex"); + let hash = crypto.createHash("md5").update(buffer).digest("hex"); const type = await fileTypeFromBuffer(buffer); if (!type || !ALLOWED_MIME_TYPES.includes(type.mime)) throw new HTTPError("Invalid file type"); diff --git a/src/cdn/util/basicCrdFileRouter.ts b/src/cdn/util/basicCrdFileRouter.ts index 7490d54..1d2f76b 100644 --- a/src/cdn/util/basicCrdFileRouter.ts +++ b/src/cdn/util/basicCrdFileRouter.ts @@ -51,7 +51,7 @@ const { buffer, size } = req.file; const { user_id } = req.params as { [key: string]: string }; - let hash = crypto.createHash("md5").update(Snowflake.generate()).digest("hex"); + let hash = crypto.createHash("md5").update(buffer).digest("hex"); const type = await fileTypeFromBuffer(buffer); if (!type || !ALLOWED_MIME_TYPES.includes(type.mime)) throw new HTTPError("Invalid file type");