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: avoid leading double slash #8846

Merged
merged 2 commits into from
May 12, 2023
Merged

fix: avoid leading double slash #8846

merged 2 commits into from
May 12, 2023

Conversation

caugner
Copy link
Contributor

@caugner caugner commented May 12, 2023

Summary

Problem

  1. When getting the locale via useParams(), we may get an invalid (unsanitized) locale.
  2. When normalizing multiple leading trailing slashes in our Cloud Function, we don't take encoded slashes into consideration.

Solution

  1. Always use useLocale() to ensure we get a valid locale.
  2. Remove encoded leading slashes by redirecting.

How did you test this change?

https://developer.allizom.xyz/%2fexample.com redirects to https://developer.allizom.xyz/example.com.

@caugner caugner requested review from LeoMcA and fiji-flo May 12, 2023 10:51
@github-actions github-actions bot added the plus work around features related to MDN Plus label May 12, 2023
Copy link
Member

@LeoMcA LeoMcA left a comment

Choose a reason for hiding this comment

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

lgtm

@caugner
Copy link
Contributor Author

caugner commented May 12, 2023

@LeoMcA Maybe we should merge #8661 first, and deploy it there to test before.

@caugner caugner force-pushed the avoid-leading-double-slash branch from c575481 to 05de965 Compare May 12, 2023 17:05
@caugner caugner temporarily deployed to xyz May 12, 2023 17:09 — with GitHub Actions Inactive
@caugner caugner marked this pull request as ready for review May 12, 2023 19:16
@caugner caugner merged commit 0fb0fa9 into main May 12, 2023
@caugner caugner deleted the avoid-leading-double-slash branch May 12, 2023 19:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plus work around features related to MDN Plus
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants