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: use startsWith() instead of exact match comparison #1856

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

Conversation

andresmarpz
Copy link

@andresmarpz andresmarpz commented Dec 20, 2024

  • All new/changed/fixed functionality is covered by tests (or N/A)
  • I have added documentation for all new/changed functionality (or N/A)

📋 Changes

Updates the checks from a strict equals condition to a startsWith(), since the URL could have trailing slash

📎 References

🎯 Testing

On the base v4 branch, boot up a test app and go to /auth/login, that should succeed. Then, on next.config.ts, set the config:

const config = {
  // ..more values
  trailingSlash: true
}

It won't work because an exact comparison won't be matched. It'll check /auth/login/ (the pathname on the middleware request) vs /auth/login (what's currently used as the hardcoded route on the mapping object).

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.

1 participant