mirror of
https://github.com/spacebarchat/server.git
synced 2026-03-30 16:05:41 +00:00
CDN: use file contents for hashes, the fuck
This commit is contained in:
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user