From aa663a1c5308c2035e1aa73836b932eba040abfc Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 12 Sep 2023 17:17:23 +0200 Subject: Avoid duplicate registration of initial directory --- src/index.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/index.ts') 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); } -- cgit 1.4.1