mirror of
https://github.com/withastro/astro.git
synced 2025-02-03 22:29:08 -05:00
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,
|
collection,
|
||||||
}: Pick<ContentPaths, 'contentDir'> & { entry: URL; collection: string }): string {
|
}: Pick<ContentPaths, 'contentDir'> & { entry: URL; collection: string }): string {
|
||||||
const relativePath = getRelativeEntryPath(entry, collection, contentDir);
|
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;
|
return withoutFileExt;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue