diff options
| -rwxr-xr-x | http/file_server.ts | 2 | ||||
| -rw-r--r-- | http/file_server_test.ts | 12 |
2 files changed, 13 insertions, 1 deletions
diff --git a/http/file_server.ts b/http/file_server.ts index 21482e747..5ef891aa8 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 38071d3e4..578b0e624 100644 --- a/http/file_server_test.ts +++ b/http/file_server_test.ts @@ -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(); } |
