Don't download image contents during prefetch if not needed (#4363)

This commit is contained in:
sfan5 2021-11-23 01:59:33 +01:00 committed by GitHub
parent 4419029d2e
commit 5f7ec9e8da
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -403,7 +403,8 @@ function fetch(uri, headers) {
if (imageTypeRegex.test(contentType)) { if (imageTypeRegex.test(contentType)) {
// response is an image // response is an image
// if Content-Length header reports a size exceeding the prefetch limit, abort fetch // if Content-Length header reports a size exceeding the prefetch limit, abort fetch
if (contentLength > limit) { // and if file is not to be stored we don't need to download further either
if (contentLength > limit || !Helper.config.prefetchStorage) {
gotStream.destroy(); gotStream.destroy();
} }
} else if (mediaTypeRegex.test(contentType)) { } else if (mediaTypeRegex.test(contentType)) {