Skip to content

Commit 081b916

Browse files
committed
Properly compute relative path
Fixes #4806
1 parent e9db2b7 commit 081b916

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/project/types/website/listing/website-listing-read.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -358,12 +358,13 @@ export function completeListingItems(
358358
});
359359

360360
if (contents.previewImage) {
361-
const imagePath = isAbsolute(contents.previewImage.src)
361+
const imgAbsPath = isAbsolute(contents.previewImage.src)
362362
? contents.previewImage.src
363-
: join(dirname(docRelativePath), contents.previewImage.src);
363+
: join(dirname(docAbsPath), contents.previewImage.src);
364364

365+
const imgRelPath = relative(dirname(outputFile.file), imgAbsPath);
365366
const imgHtml = imageSrc(
366-
{ ...contents.previewImage, src: imagePath },
367+
{ ...contents.previewImage, src: imgRelPath },
367368
progressive,
368369
imgHeight,
369370
);

0 commit comments

Comments
 (0)