From 513b8c47aa72970d07eb72827a926837731ceef5 Mon Sep 17 00:00:00 2001 From: nimesh0505 Date: Wed, 4 Sep 2024 11:30:34 +0530 Subject: [PATCH] optimize root path checks for CWD scenario --- index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/index.js b/index.js index c186030..6b4857e 100644 --- a/index.js +++ b/index.js @@ -442,6 +442,10 @@ function checkRootPathForErrors (fastify, rootPath, skipExistenceCheck) { } function checkPath (fastify, rootPath, skipExistenceCheck) { + // skip all checks if rootPath is the CWD + if (rootPath === process.cwd()) { + return + } if (typeof rootPath !== 'string') { throw new Error('"root" option must be a string') }