mirror of
https://github.com/denoland/deno.git
synced 2024-10-30 09:08:00 -04:00
fix(fileserver): wrong url href of displayed files (denoland/deno_std#426)
Original: be6cd35cbf
This commit is contained in:
parent
de713ea871
commit
e2debab359
2 changed files with 13 additions and 1 deletions
|
@ -162,7 +162,7 @@ async function serveDir(
|
|||
listEntry.push(
|
||||
createDirEntryDisplay(
|
||||
info.name,
|
||||
fn,
|
||||
fn.replace(currentDir, ""),
|
||||
info.isFile() ? info.len : null,
|
||||
mode,
|
||||
info.isDirectory()
|
||||
|
|
|
@ -56,6 +56,18 @@ test(async function serveDirectory(): Promise<void> {
|
|||
assert(res.headers.has("access-control-allow-headers"));
|
||||
const page = await res.text();
|
||||
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 {
|
||||
killFileServer();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue