From 955b8751cbdf3ae9f009e1e77a405b6393af6c1d Mon Sep 17 00:00:00 2001 From: bholmesdev Date: Fri, 10 Feb 2023 18:02:50 -0500 Subject: [PATCH 1/2] fix: avoid url -> file -> url parsing --- packages/astro/src/content/utils.ts | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/packages/astro/src/content/utils.ts b/packages/astro/src/content/utils.ts index afde00743394..857da52ef65b 100644 --- a/packages/astro/src/content/utils.ts +++ b/packages/astro/src/content/utils.ts @@ -163,11 +163,10 @@ export function getEntryType( entryPath: string, paths: Pick ): 'content' | 'config' | 'ignored' | 'unsupported' { - const { dir: rawDir, ext, base } = path.parse(entryPath); - const dir = appendForwardSlash(pathToFileURL(rawDir).href); - const fileUrl = new URL(base, dir); + const { ext, base } = path.parse(entryPath); + const fileUrl = pathToFileURL(entryPath); - if (hasUnderscoreInPath(fileUrl) || isOnIgnoreList(fileUrl)) { + if (hasUnderscoreInPath(fileUrl) || isOnIgnoreList(base)) { return 'ignored'; } else if ((contentFileExts as readonly string[]).includes(ext)) { return 'content'; @@ -178,9 +177,8 @@ export function getEntryType( } } -function isOnIgnoreList(fileUrl: URL) { - const { base } = path.parse(fileURLToPath(fileUrl)); - return ['.DS_Store'].includes(base); +function isOnIgnoreList(fileName: string) { + return ['.DS_Store'].includes(fileName); } function hasUnderscoreInPath(fileUrl: URL): boolean { From aa96e9f0ed36c95c27cbcc8f63eec32dd601f2ac Mon Sep 17 00:00:00 2001 From: bholmesdev Date: Fri, 10 Feb 2023 18:13:27 -0500 Subject: [PATCH 2/2] chore: changeset --- .changeset/orange-sheep-deliver.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/orange-sheep-deliver.md diff --git a/.changeset/orange-sheep-deliver.md b/.changeset/orange-sheep-deliver.md new file mode 100644 index 000000000000..cf8ecf31870d --- /dev/null +++ b/.changeset/orange-sheep-deliver.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Fix: internal content collection error on spaces in file name