fix(data collections): normalize file paths for DataEntry.id (#8144)
* normalize file paths for DataEntry.id * add changeset
This commit is contained in:
parent
e3c030e5d3
commit
04caa99c48
2 changed files with 6 additions and 1 deletions
5
.changeset/twenty-mirrors-remember.md
Normal file
5
.changeset/twenty-mirrors-remember.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
'astro': patch
|
||||
---
|
||||
|
||||
Fixed an issue where data entries' id included backslashes instead of forward slashes on Windows.
|
|
@ -209,7 +209,7 @@ export function getDataEntryId({
|
|||
collection,
|
||||
}: Pick<ContentPaths, 'contentDir'> & { entry: URL; collection: string }): string {
|
||||
const relativePath = getRelativeEntryPath(entry, collection, contentDir);
|
||||
const withoutFileExt = relativePath.replace(new RegExp(path.extname(relativePath) + '$'), '');
|
||||
const withoutFileExt = normalizePath(relativePath).replace(new RegExp(path.extname(relativePath) + '$'), '');
|
||||
|
||||
return withoutFileExt;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue