Skip to content

Commit

Permalink
add comments to explain routing logic
Browse files Browse the repository at this point in the history
  • Loading branch information
emily-shen committed Sep 10, 2024
1 parent f7594ce commit 20ca75f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/wrangler/src/deploy/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,13 +192,16 @@ export const validateRoutes = (
const components = pattern.split("/");

if (
// = ["route.com"] bare domains are invalid as it would only match exactly that
components.length === 1 ||
// = ["route.com",""] as above
(components.length === 2 && components[1] === "")
) {
invalidRoutes[pattern] ??= [];
invalidRoutes[pattern].push(
`Workers which have static assets must end with a wildcard path. Update the route to end with /*`
);
// ie it doesn't match exactly "route.com/*" = [route.com, *]
} else if (!(components.length === 2 && components[1] === "*")) {
invalidRoutes[pattern] ??= [];
invalidRoutes[pattern].push(
Expand Down

0 comments on commit 20ca75f

Please sign in to comment.