CDN: use file contents for hashes, the fuck

This commit is contained in:
Rory&
2026-03-19 08:18:16 +01:00
parent 7a81d07ad3
commit b839c0a2c4
14 changed files with 14 additions and 14 deletions

View File

@@ -51,7 +51,7 @@ export function createBasicCrdFileRouter(opts: BasicCrdFileRouterOptions) {
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");