fix: avoid redirecting /opensearch.xml to package route#1546
fix: avoid redirecting /opensearch.xml to package route#1546shuuji3 wants to merge 1 commit intonpmx-dev:mainfrom
/opensearch.xml to package route#1546Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
2 Skipped Deployments
|
📝 WalkthroughWalkthroughThe change modifies the canonical redirects middleware by adding '/opensearch.xml' to the list of pages that bypass redirect logic. This ensures that requests to the opensearch.xml path are treated as a known page and not subject to further redirection. Previously, such requests were being incorrectly redirected to a non-existent path, resulting in 404 errors. 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
server/middleware/canonical-redirects.global.ts (1)
15-30: LGTM — fix is correct.Adding
/opensearch.xmlto thepagesbypass list is the right approach. The root cause is thatpkgMatch(/^\/(?:(?<org>@[^/]+)\/)?(?<name>[^/@]+)$/) matches the path because.is allowed in[^/@]+, yieldingname = 'opensearch.xml'and an erroneous 301 to/package/opensearch.xml. The early-return guard at line 47 now correctly intercepts the path beforepkgMatchis evaluated.Optionally, for consistency with the rest of the list, consider placing
/opensearch.xmlin alphabetical order alongside its neighbours (after/about//accessibility):♻️ Optional reordering for readability
const pages = [ '/oauth-client-metadata.json', '/200.html', - '/opensearch.xml', '/about', '/accessibility', '/compare', '/org', + '/opensearch.xml', '/package', '/package-code', '/package-docs', '/privacy', '/search', '/settings', '/recharging', ]
fix #1545
(The deploy error is unrelated to this change. See #1547 for details.)