From 02e925ae109d52a9a00182b802565eb32971ec4b Mon Sep 17 00:00:00 2001 From: GatsbyJS Bot Date: Fri, 20 Oct 2023 07:12:41 -0400 Subject: [PATCH] fix(gatsby): support multiple instances of same variable in gatsbyImage placeholderUrl (#38626) (#38647) (cherry picked from commit b177db996647785c96e5eed02a63b90fec992b19) Co-authored-by: Carlos Fernandes Cunha --- .../src/polyfill-remote-file/placeholder-handler.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/gatsby-plugin-utils/src/polyfill-remote-file/placeholder-handler.ts b/packages/gatsby-plugin-utils/src/polyfill-remote-file/placeholder-handler.ts index c97cdd2863604..df769271ea23c 100644 --- a/packages/gatsby-plugin-utils/src/polyfill-remote-file/placeholder-handler.ts +++ b/packages/gatsby-plugin-utils/src/polyfill-remote-file/placeholder-handler.ts @@ -273,7 +273,7 @@ function generatePlaceholderUrl({ const aspectRatio = originalWidth / originalHeight return url - .replace(`%width%`, String(width)) - .replace(`%height%`, Math.floor(width / aspectRatio).toString()) - .replace(`%quality%`, String(quality)) + .replaceAll(`%width%`, String(width)) + .replaceAll(`%height%`, Math.floor(width / aspectRatio).toString()) + .replaceAll(`%quality%`, String(quality)) }