Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/legal-camels-poke.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'astro': minor
---

Ensure Astro.url.pathname returns the correct file extension when build.format.preserved is enabled
7 changes: 6 additions & 1 deletion packages/astro/src/core/build/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,12 @@ function getUrlForPath(
switch (format) {
case 'directory':
case 'preserve': {
ending = trailingSlash === 'never' ? '' : '/';
const isNamedPathnameRegex = /\/[a-zA-Z-0-9]+/;
if (isNamedPathnameRegex.test(pathname)) {
ending = '.html'
} else {
ending = trailingSlash === 'never' ? '' : '/';
}
break;
}
case 'file':
Expand Down
Loading