Fix double-encoded filter name in date range inputs#136
Open
Varlin wants to merge 1 commit into
Open
Conversation
pass the raw (non-encoded) filter name to getDateRangeInput() to avoid double encoding, which breaks URL in case of accents
Codecov Report✅ All modified and coverable lines are covered by tests.
Additional details and impacted files@@ Coverage Diff @@
## master #136 +/- ##
=============================================
- Coverage 77.70% 34.61% -43.10%
=============================================
Files 36 1 -35
Lines 2373 52 -2321
Branches 7 7
=============================================
- Hits 1844 18 -1826
+ Misses 524 29 -495
Partials 5 5 ☔ View full report in Codecov by Sentry. 🚀 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.
Issue : The filters based on datepicker range filters send wrong URLs when the date property contains special characters like accents.
Exemple : "?_lower_Date_de_d%25C3%25A8s" instead of "?_lower_Date_de_décès=2020-02-13..."
Cause : In GetApplicableFilters::getUnappliedFilterLine(), $filter_name is built with urlencode() for use in link URLs. This encoded value is also passed to getDateRangeInput(), causing the attributes to contain already-encoded characters (e.g. "Date_de_d%C3%A8s"). When the browser submits the form, it encodes them a second time (e.g. "Date_de_d%25C3%25A8s"), which no longer matches the filter name expected by SpecialBrowseData, so the date range filter has no effect.
Fix: pass the raw (non-encoded) filter name to getDateRangeInput(), just replacing white spaces with underscores.