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 broken redirect #596

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

maddsua
Copy link

@maddsua maddsua commented Mar 22, 2024

This fix covers an edgecase when a link that has search params and resolves to a directory
(think of /checkout?services=setup-cctv which resolves to a file dist/checkout/index.html) is reported as broken.

The issue lies in an oversight in src/server.ts:83, where request url is assumed to not have search params when a slash appended to it to implement a directory redirect.

It's fixed with actually parsing URL and appending slash only to pathname instead of the entire url string. Also, I implemented it as a separate URL object to not make things complicated - one object for the original URL and the other for redirect URL specifically.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant