Skip to content

Commit 48f10ce

Browse files
committed
fix: update file links to handle root path correctly
1 parent f5ccd39 commit 48f10ce

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

commands/http.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,9 @@ class HttpCommand extends Command {
9797
return a.filename.toLowerCase() < b.filename.toLowerCase() ? -1 : 1;
9898
});
9999
files.forEach(f => {
100-
htmlContent += `<li><a href="${url.pathname}/${f.filename}">${f.filename}</a></li>`;
100+
let p = url.pathname === '/' ? '.' : url.pathname;
101+
p = p + '/' + f.filename;
102+
htmlContent += `<li><a href="${p}">${f.filename}</a></li>`;
101103
});
102104
htmlContent += '</ul>';
103105
result(htmlContent, 200, { 'Content-Type': 'text/html' });

0 commit comments

Comments
 (0)