diff --git a/lib/image.js b/lib/image.js index 09aea7a..07ca0f4 100644 --- a/lib/image.js +++ b/lib/image.js @@ -27,7 +27,6 @@ function encodeSvg(content) { ); } - async function assertSize(resource, maxFileSize, throwError = true) { const {mime, contents = ''} = resource || {}; const encoding = mime === 'image/svg+xml' ? 'utf-8' : 'binary'; @@ -76,12 +75,15 @@ async function getDataUriMapping(urls = [], options = {}) { const file = await resolve(url, options); if (file && file.mime && /image/.test(file.mime)) { return [url, await getDataUri(file, options)]; - } else if (options.largeFileCallback) { + } + + if (options.largeFileCallback) { const largeFile = await resolve(url, {...options, maxFileSize: 0}); if (largeFile && largeFile.mime && /image/.test(largeFile.mime)) { return [url, await options.largeFileCallback(largeFile)]; } } + return [url, null]; }); const results = await Promise.all(promises);