beetsplug/web: fix translation of query path - #4182
Merged
Merged
Conversation
Member
|
I think this looks right—I imagine it was just broken before! Thanks for tracking this down. This seems related to #3567, so perhaps @nmeum would be able to take a look to make sure we're not doing anything wrong? And in the mean time, @sumpfralle, any chance you could add a quick changelog entry describing the fix? |
The routing map translator `QueryConverter` was misconfigured:
* decoding (parsing a path): splitting with "/" as tokenizer
* encoding (translating back to a path): joining items with "," as separator
This caused queries containing more than one condition (separated by a
slash) to return an empty result. Queries with only a single condition
were not affected.
Instead the encoding should have used the same delimiter (the slash) for the
backward conversion.
How to reproduce:
* query: `/album/query/albumartist::%5Efoo%24/original_year%2B/year%2B/album%2B`
* resulting content in parsed argument `queries` in the `album_query` function:
* previous (wrong): `['albumartist::^foo$,original_year+,year+,album+']`
* new (correct): `['albumartist::^foo$', 'original_year+', 'year+', 'album+']`
Contributor
Author
|
I added a changelog entry. |
Member
|
Looks good; thank you! Please feel free to weigh in if we are doing something wrong, @nmeum. |
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.
The routing map translator
QueryConverterwas misconfigured:Instead the encoding should have used the same delimiter (the slash) for the backward conversion.
How to reproduce:
/album/query/albumartist::%5Efoo%24/original_year%2B/year%2B/album%2Bqueriesin thealbum_queryfunction:['albumartist::^foo$,original_year+,year+,album+']['albumartist::^foo$', 'original_year+', 'year+', 'album+']I am not sure, why the issue was not noticed before. Maybe
werkzeugs handling of routing maps has changed.