From 6867034ec9a3336ee4a876e1a86a57fc11533da6 Mon Sep 17 00:00:00 2001 From: saberzero1 Date: Mon, 23 Sep 2024 20:05:38 +0200 Subject: [PATCH] Fixed image theme check --- quartz/components/scripts/util.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/quartz/components/scripts/util.ts b/quartz/components/scripts/util.ts index 4538baace..ce3b986fc 100644 --- a/quartz/components/scripts/util.ts +++ b/quartz/components/scripts/util.ts @@ -24,8 +24,9 @@ export function renderThemedLinks(theme: "dark" | "light") { const imageGroups = { theme: 1, extension: 2 } Object.values(document.getElementsByTagName("img")).forEach((img) => { if (img.src.match(imageExtensions)) { - const newImg = imageExtensions.exec(img.src) - img.src.replace(imageExtensions, `.${theme}.${newImg![imageGroups.extension]}`) + const imageSource = img.src + const newImg = imageExtensions.exec(imageSource) + img.src = imageSource.replace(imageExtensions, `.${theme}.${newImg![imageGroups.extension]}`) } }) }