Fixed: search_source referrer duplicating the subdirectory on subdirectory installs - #325
Conversation
…ry installs Search::get_referrer() built the referrer as home_url( add_query_arg( null, null ) ). add_query_arg( null, null ) returns the current REQUEST_URI, which on a subdirectory install (site under e.g. /dev) already includes the subdirectory; home_url() then prepends the home path again, producing a doubled prefix like https://example.com/dev/dev/sample-page/?s=test. Take the scheme and host from the configured home_url() and append the request path/query directly, so the subdirectory appears exactly once. Deriving the scheme from home_url() also keeps the referrer on https behind a reverse proxy, where is_ssl() may be unreliable.
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthrough
ChangesReferrer URL construction
Priority: ⬇️ Low Change: Bug fix Merge Risk: ⚪ Minimal · up to The referrer change has no identified issue requiring a fix before merge. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 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 |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Search::get_referrer() built the referrer as home_url( add_query_arg( null, null ) ). add_query_arg( null, null ) returns the current REQUEST_URI, which on a subdirectory install (site under e.g. /dev) already includes the subdirectory; home_url() then prepends the home path again, producing a doubled prefix like https://example.com/dev/dev/sample-page/?s=test.
Take the scheme and host from the configured home_url() and append the request path/query directly, so the subdirectory appears exactly once. Deriving the scheme from home_url() also keeps the referrer on https behind a reverse proxy, where is_ssl() may be unreliable.
Summary by CodeRabbit