Skip to content

fix: respect trailingSlash on root#3920

Open
divine wants to merge 1 commit intonuxt-modules:mainfrom
divine:fix-redirect-with-trailing-slash
Open

fix: respect trailingSlash on root#3920
divine wants to merge 1 commit intonuxt-modules:mainfrom
divine:fix-redirect-with-trailing-slash

Conversation

@divine
Copy link
Contributor

@divine divine commented Feb 3, 2026

🔗 Linked issue

📚 Description

Resolves an issue when visiting: example.com it redirects to example.com/en while it should redirect to example.com/en/

It doesn't respect the trailingSlash option which is breaking change from v9 to v10.

I don't know where to push the test file as trailingSlash option isn't a runtime config anymore.

Summary by CodeRabbit

  • New Features
    • Added configurable trailing slash formatting for localized paths. Localized URLs can now be automatically formatted with or without trailing slashes based on your application configuration settings.

@divine divine requested a review from BobbieGoede as a code owner February 3, 2026 11:36
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 3, 2026

Walkthrough

This change adds conditional trailing-slash formatting support for localized path generation in the matching logic. It introduces new utility imports from 'ufo' (withTrailingSlash, withoutTrailingSlash) and a formatter constant that toggles based on the __TRAILING_SLASH__ configuration. The path construction in matchLocalized now applies this formatter to the result when a match is found, enabling or disabling trailing slashes accordingly.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main fix: respecting the trailingSlash configuration on root path redirects, which is the core change in the localized path generation logic.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Important

Action Needed: IP Allowlist Update

If your organization protects your Git platform with IP whitelisting, please add the new CodeRabbit IP address to your allowlist:

  • 136.113.208.247/32 (new)
  • 34.170.211.100/32
  • 35.222.179.152/32

Failure to add the new IP will result in interrupted reviews.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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