Properly request only the first 1024 bytes when getting image type

This commit is contained in:
TheEssem 2021-01-04 11:10:57 -06:00
parent dd114e27b5
commit 2a3f84f628
1 changed files with 3 additions and 1 deletions

View File

@ -93,7 +93,9 @@ exports.getType = async (image) => {
controller.abort();
}, 25000);
try {
const imageRequest = await fetch(image, { signal: controller.signal, highWaterMark: 512 });
const imageRequest = await fetch(image, { signal: controller.signal, headers: {
"Range": "bytes=0-1023"
}});
clearTimeout(timeout);
const imageBuffer = await imageRequest.buffer();
const imageType = await fileType.fromBuffer(imageBuffer);