about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAlan Pearce2023-09-12 17:17:23 +0200
committerAlan Pearce2023-09-12 17:17:23 +0200
commitaa663a1c5308c2035e1aa73836b932eba040abfc (patch)
tree60ad979e7bc6eb2362861aa5aeaa76b79e7082cb
parent0ded4a2bf46a7c0e00523bf2f216fbfba12ba4d5 (diff)
downloadwebsite-aa663a1c5308c2035e1aa73836b932eba040abfc.tar.lz
website-aa663a1c5308c2035e1aa73836b932eba040abfc.tar.zst
website-aa663a1c5308c2035e1aa73836b932eba040abfc.zip
Avoid duplicate registration of initial directory
-rw-r--r--src/index.ts7
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);
     }