Re-add a form of size limit

This commit is contained in:
TheEssem 2021-05-06 22:01:30 -05:00
parent 364d8bf006
commit c4b57ac617
2 changed files with 8 additions and 0 deletions

View file

@ -210,6 +210,10 @@ exports.getType = async (image) => {
"Range": "bytes=0-1023"
}});
clearTimeout(timeout);
if (parseInt(imageRequest.headers.get("Content-Range").split("/")[1]) > 20971520) {
type = "large";
return type;
}
const imageBuffer = await imageRequest.buffer();
const imageType = await fileType.fromBuffer(imageBuffer);
if (imageType && formats.includes(imageType.mime)) {