Skip to content
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(redirects): handle non-verbatim targets #9089

Merged
merged 5 commits into from
Dec 19, 2023
Merged

Conversation

lilnasy
Copy link
Contributor

@lilnasy lilnasy commented Nov 13, 2023

Changes

Testing

Docs

Does not affect usage.

Copy link

changeset-bot bot commented Nov 13, 2023

🦋 Changeset detected

Latest commit: 5689425

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

@github-actions github-actions bot added the pkg: astro Related to the core `astro` package (scope) label Nov 13, 2023
@@ -20,6 +20,7 @@ export function redirectRouteGenerate(redirectRoute: RouteData, data: Params): s
if (typeof routeData !== 'undefined') {
return routeData?.generate(data) || routeData?.pathname || '/';
} else if (typeof route === 'string') {
console.log({ data, pattern: route});
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

@florian-lefebvre
Copy link
Member

@lilnasy what's the status of this PR? Did you encounter some blocker?

@lilnasy
Copy link
Contributor Author

lilnasy commented Dec 15, 2023

It's just here to explain the code path that goes wrong.

@github-actions github-actions bot added the pr: docs A PR that includes documentation for review label Dec 15, 2023
@lilnasy lilnasy marked this pull request as ready for review December 15, 2023 17:15
packages/astro/test/redirects.test.js Outdated Show resolved Hide resolved
packages/astro/test/redirects.test.js Outdated Show resolved Hide resolved
Comment on lines 26 to 27
for (const param in data) {
const paramValue = data[param]!
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I don't like very much the use of for..in, we should use for..of

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

its not an array

Copy link
Member

@ematipico ematipico Dec 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const dataAsArray  =Object.entries(data);

if (dataAsArray.length > 0) {
	for (const t of dataAsArray) {}
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh didnt see this, implemented using object.keys

Copy link
Member

@natemoo-re natemoo-re left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks for the fix

@ematipico ematipico merged commit 5ae6578 into withastro:main Dec 19, 2023
13 checks passed
@lilnasy lilnasy deleted the fix/8914 branch December 19, 2023 14:00
@astrobot-houston astrobot-houston mentioned this pull request Dec 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg: astro Related to the core `astro` package (scope) pr: docs A PR that includes documentation for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Configured Redirects with more than two params don't expand properly
4 participants