Acccount for cases where Content-Range doesn't exist

This commit is contained in:
TheEssem 2021-05-14 22:02:50 -05:00
parent 787eb347f6
commit 21a98e216d
No known key found for this signature in database
GPG key ID: A3F9F02129092FCA

View file

@ -204,7 +204,8 @@ exports.getType = async (image) => {
"Range": "bytes=0-1023"
}});
clearTimeout(timeout);
if (parseInt(imageRequest.headers.get("Content-Range").split("/")[1]) > 20971520) {
const size = imageRequest.headers.has("Content-Range") ? imageRequest.headers.get("Content-Range").split("/")[1] : imageRequest.headers.get("Content-Length");
if (parseInt(size) > 20971520) {
type = "large";
return type;
}