From 22ce5af967a3bc7b5be5f713816321355aaf7326 Mon Sep 17 00:00:00 2001 From: Dom Date: Fri, 29 Jan 2021 19:16:26 +0100 Subject: [PATCH] fix(gatsby-plugin-sharp): make sure to pass the failOnError option to base64 generation (#29254) * make sure to pass the failOnError option to base64 generation * Update packages/gatsby-plugin-sharp/src/index.js Co-authored-by: Vladimir Razuvaev Co-authored-by: Dominik Voss Co-authored-by: Vladimir Razuvaev (cherry picked from commit bc0f5c8f12c3bfd01c653e428566ffba5f01edcc) --- packages/gatsby-plugin-sharp/src/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/gatsby-plugin-sharp/src/index.js b/packages/gatsby-plugin-sharp/src/index.js index 36fadb06d23da..361e03bfc510b 100644 --- a/packages/gatsby-plugin-sharp/src/index.js +++ b/packages/gatsby-plugin-sharp/src/index.js @@ -274,7 +274,9 @@ async function generateBase64({ file, args = {}, reporter }) { }) let pipeline try { - pipeline = sharp(file.absolutePath) + pipeline = !options.failOnError + ? sharp(file.absolutePath, { failOnError: false }) + : sharp(file.absolutePath) if (!options.rotate) { pipeline.rotate()