Fix Incorrect URL Links In Wagtail Based On Browser Language#1485
Draft
dchukhin wants to merge 1 commit into
Draft
Fix Incorrect URL Links In Wagtail Based On Browser Language#1485dchukhin wants to merge 1 commit into
dchukhin wants to merge 1 commit into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1485 +/- ##
==========================================
+ Coverage 79.26% 79.34% +0.07%
==========================================
Files 154 154
Lines 10569 10592 +23
==========================================
+ Hits 8378 8404 +26
+ Misses 2191 2188 -3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
One-line summary
When a user's profile in Wagtail (or their browser language) is set to an alias locale, some links in Wagtail incorrectly point to the alias locale.
Significant changes and points to review
WagtailAdminRequestMiddlewaretracks if the request is for a Wagtail admin URLAbstractSpringfieldCMSPage.get_url_parts()explicitly overrides the locale if 1. the request is for a Wagtail admin URL and 2. the locale does not match the page's locale (as a note, there is no public-facing behavior change here)WAGTAIL_ADMIN_URL_PREFIXsetting for the Wagtail admin prefix (no behavior change here, just setting this in settings, so it can be used in another file)Issue / Bugzilla link
Testing
Steps to recreate the bug:
To test the fix, follow the same steps, but observe that the "PUBLICADA" link points to the pt-BR page.