提交 e2debab3 编写于 作者: Y Yuqing Chen 提交者: Bert Belder

fix(fileserver): wrong url href of displayed files (denoland/deno_std#426)


Original: https://github.com/denoland/deno_std/commit/be6cd35cbf65ef49b15bf0faf1e582d79f5a0f87
上级 de713ea8
...@@ -162,7 +162,7 @@ async function serveDir( ...@@ -162,7 +162,7 @@ async function serveDir(
listEntry.push( listEntry.push(
createDirEntryDisplay( createDirEntryDisplay(
info.name, info.name,
fn, fn.replace(currentDir, ""),
info.isFile() ? info.len : null, info.isFile() ? info.len : null,
mode, mode,
info.isDirectory() info.isDirectory()
......
...@@ -56,6 +56,18 @@ test(async function serveDirectory(): Promise<void> { ...@@ -56,6 +56,18 @@ test(async function serveDirectory(): Promise<void> {
assert(res.headers.has("access-control-allow-headers")); assert(res.headers.has("access-control-allow-headers"));
const page = await res.text(); const page = await res.text();
assert(page.includes("azure-pipelines.yml")); assert(page.includes("azure-pipelines.yml"));
// `Deno.FileInfo` is not completely compatible with Windows yet
// TODO: `mode` should work correctly in the future. Correct this test case accordingly.
Deno.platform.os !== "win" &&
assert(/<td class="mode">\([a-zA-Z-]{10}\)<\/td>/.test(page));
Deno.platform.os === "win" &&
assert(/<td class="mode">\(unknown mode\)<\/td>/.test(page));
assert(
page.includes(
`<td><a href="/azure-pipelines.yml">azure-pipelines.yml</a></td>`
)
);
} finally { } finally {
killFileServer(); killFileServer();
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册