Skip to content

Commit 5122e24

Browse files
committed
fix: ensure pathname ends with a trailing slash for correct URL construction in HTML rendering
1 parent d31781b commit 5122e24

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/index.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,12 @@ class CoCreateServerSideRender {
107107
src = src.replaceAll(/\$relativePath\/?/g, path);
108108
}
109109

110+
let pathname = file.path
111+
if (!pathname.endsWith("/")) {
112+
pathname += "/";
113+
}
110114
// Construct actual pathname using src and the original URL
111-
let pathname = new URL(src, `http://localhost${file.path}`)
115+
pathname = new URL(src, `http://localhost${pathname}`)
112116
.pathname;
113117

114118
if (pathname.endsWith("/")) {

0 commit comments

Comments
 (0)