diff --git a/http/file_server.ts b/http/file_server.ts index 21482e7470..5ef891aa84 100755 --- a/http/file_server.ts +++ b/http/file_server.ts @@ -162,7 +162,7 @@ async function serveDir( listEntry.push( createDirEntryDisplay( info.name, - fn, + fn.replace(currentDir, ""), info.isFile() ? info.len : null, mode, info.isDirectory() diff --git a/http/file_server_test.ts b/http/file_server_test.ts index 38071d3e4b..578b0e6241 100644 --- a/http/file_server_test.ts +++ b/http/file_server_test.ts @@ -56,6 +56,18 @@ test(async function serveDirectory(): Promise { 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(/\([a-zA-Z-]{10}\)<\/td>/.test(page)); + Deno.platform.os === "win" && + assert(/\(unknown mode\)<\/td>/.test(page)); + assert( + page.includes( + `azure-pipelines.yml` + ) + ); } finally { killFileServer(); }