-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: match index files only by using entire basename #12815
base: main
Are you sure you want to change the base?
Conversation
The previous code would cause file names like `index.xml.ts` to be treated as index files, when they aren't (the file basename excluding the extension `.ts` is `index.xml`, and `index` should be the index file). To match index files only, match the entire first half of the basename when splitting by the last occurrence of the period/file extension delimiter. Pedantically this might not be correct -- i.e. some file extensions actually span multiple delimiters, like index.tar.gz. But in that case it's not an index file as well, so I think this is fine. Fixes withastro#12675
🦋 Changeset detectedLatest commit: 65516f1 The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
CodSpeed Performance ReportMerging #12815 will not alter performanceComparing Summary
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR is blocked because it contains a minor
changeset. A reviewer will merge this at the next release if approved.
@@ -0,0 +1,5 @@ | |||
--- | |||
'astro': minor |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be a patch
because it's a bugfix not new feature
The previous code would cause file names like
index.xml.ts
to be treated as index files, when they aren't (the file basename excluding the extension.ts
isindex.xml
, andindex
should be the index file). To match index files only, match the entire first half of the basename when splitting by the last occurrence of the period/file extension delimiter.Pedantically this might not be correct -- i.e. some file extensions actually span multiple delimiters, like
index.tar.gz
. But in that case it's not an index file as well, so I think this is fine.Fixes #12675
Changes
pnpm exec changeset
Testing
This was tested with my website repository that I'm using to migrate to Astro. This may need more tests to make sure it is not a breaking change.
Docs
Possibly -- files that were considered index files may not be and vice versa. Although I think this change should only include files that were previously excluded by the
.startswith("index.")
check./cc @withastro/maintainers-docs for feedback!