diff options
author | Alan Pearce | 2023-09-12 17:17:23 +0200 |
---|---|---|
committer | Alan Pearce | 2023-09-12 17:17:23 +0200 |
commit | aa663a1c5308c2035e1aa73836b932eba040abfc (patch) | |
tree | 60ad979e7bc6eb2362861aa5aeaa76b79e7082cb | |
parent | 0ded4a2bf46a7c0e00523bf2f216fbfba12ba4d5 (diff) | |
download | website-aa663a1c5308c2035e1aa73836b932eba040abfc.tar.lz website-aa663a1c5308c2035e1aa73836b932eba040abfc.tar.zst website-aa663a1c5308c2035e1aa73836b932eba040abfc.zip |
Avoid duplicate registration of initial directory
-rw-r--r-- | src/index.ts | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/index.ts b/src/index.ts index e35368d..10e9da1 100644 --- a/src/index.ts +++ b/src/index.ts @@ -49,8 +49,11 @@ function walkDirectory(root: string, dir: string) { walkDirectory(root, relPath + path.sep); } else if (stat.isFile()) { if (pathname === "index.html") { - registerFile(path.dirname(relPath), absPath, stat); - registerFile(path.dirname(relPath) + path.sep, absPath, stat); + const dir = path.dirname(relPath); + registerFile(dir, absPath, stat); + if (dir !== ".") { + registerFile(dir + path.sep, absPath, stat); + } } registerFile(relPath, absPath, stat); } |