Skip to content

Commit

Permalink
fix: Astro greedy routes (#3602)
Browse files Browse the repository at this point in the history
* feat: add extension check to file match

* chore: add changeset
  • Loading branch information
bayssmekanique committed Jan 10, 2024
1 parent 4f7ecc4 commit d45f36c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/honest-vans-itch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"sst": patch
---

Astro: fix greedy routes bug
2 changes: 1 addition & 1 deletion packages/sst/src/constructs/AstroSite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export class AstroSite extends SsrSite {
var matchedRoute = findMatch(request.uri, routeData);
if (matchedRoute) {
if (!matchedRoute[1]) {
if (!matchedRoute[1] && !/^.*\\.[^\\/]+$/.test(request.uri)) {
${
pageResolution === "file"
? `request.uri = request.uri === "/" ? "/index.html" : request.uri.replace(/\\/?$/, ".html");`
Expand Down

0 comments on commit d45f36c

Please sign in to comment.