From de1bcbbe530cb760fa385ecf0c145dd5bbfde187 Mon Sep 17 00:00:00 2001 From: Elio Struyf Date: Mon, 22 Jun 2026 12:02:50 +0200 Subject: [PATCH] Issue: Hugo page bundle images inserted from local img/ folder use incorrect leading slash path Fixes #1041 --- CHANGELOG.md | 1 + src/dashboardWebView/components/Media/Item.tsx | 13 ++----------- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7a182f00..bcabf279 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ ### 🐞 Fixes - Fix number fields not being saved to front matter when used inside block field groups +- [#1041](https://github.com/estruyf/vscode-front-matter/issues/1041): Fix in image page when using page bundles ## [10.10.1] - 2026-04-23 diff --git a/src/dashboardWebView/components/Media/Item.tsx b/src/dashboardWebView/components/Media/Item.tsx index 085000ed..10de7992 100644 --- a/src/dashboardWebView/components/Media/Item.tsx +++ b/src/dashboardWebView/components/Media/Item.tsx @@ -7,7 +7,7 @@ import { PlusIcon, VideoCameraIcon, } from '@heroicons/react/24/outline'; -import { basename, parse } from 'path'; +import { basename } from 'path'; import * as React from 'react'; import { useCallback, useEffect, useMemo, useState } from 'react'; import { useRecoilState, useRecoilValue } from 'recoil'; @@ -57,17 +57,8 @@ export const Item: React.FunctionComponent = ({ const [menuOpen, setMenuOpen] = React.useState(false); const relPath = useMemo(() => { - if (viewData?.data?.pageBundle && viewData?.data?.filePath) { - const articlePath = viewData?.data?.filePath; - const articleDir = parse(parseWinPath(articlePath)).dir; - - const mediaPath = parseWinPath(media.fsPath); - if (mediaPath.startsWith(articleDir)) { - return getRelPath(media.fsPath, undefined, articleDir); - } - } return getRelPath(media.fsPath, settings?.staticFolder, settings?.wsFolder); - }, [media.fsPath, settings?.staticFolder, settings?.wsFolder, viewData?.data?.pageBundle, viewData?.data?.filePath]); + }, [media.fsPath, settings?.staticFolder, settings?.wsFolder]); const hasViewData = useMemo(() => { return viewData?.data?.filePath !== undefined;