From c68b5e664bd334833c533ec5d9a03e49dbff628d Mon Sep 17 00:00:00 2001 From: Matt Kane Date: Mon, 1 Feb 2021 12:27:15 +0000 Subject: [PATCH] fix(gatsby-plugin-sharp): make sure to pass the failOnError option to base64 generation (#29254) (#29290) * 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) Co-authored-by: Dom --- 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()