From ec2dbd8a30380f82490160010a5cb0cdd1f6d075 Mon Sep 17 00:00:00 2001 From: bholmesdev Date: Wed, 26 Apr 2023 15:23:20 -0400 Subject: [PATCH] fix: revert bad rootRelativePath change --- packages/astro/src/core/util.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/astro/src/core/util.ts b/packages/astro/src/core/util.ts index 25a2d133d..3df7a769c 100644 --- a/packages/astro/src/core/util.ts +++ b/packages/astro/src/core/util.ts @@ -158,7 +158,10 @@ export function rootRelativePath(root: URL, idOrUrl: URL | string, prependSlash } else { id = idOrUrl; } - id = id.slice(normalizePath(fileURLToPath(root)).length); + const normalizedRoot = normalizePath(fileURLToPath(root)); + if (id.startsWith(normalizedRoot)) { + id = id.slice(normalizedRoot.length); + } return prependSlash ? prependForwardSlash(id) : id; }