Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Query Value containing ';' character #49

Closed
rawdlite opened this issue Jul 9, 2015 · 5 comments
Closed

Query Value containing ';' character #49

rawdlite opened this issue Jul 9, 2015 · 5 comments
Labels
Milestone

Comments

@rawdlite
Copy link

rawdlite commented Jul 9, 2015

I have some mp3 files with multiple genres separated by ; like so:

'Acapella;Jazz Vocal;Jazz'

Now

uri = uricompose('whatever',None,'genre',dict(genre='Acapella;Jazz Vocal;Jazz'))

gives

'whatever:genre?genre=Acapella;Jazz%20Vocal;Jazz'

yet

urisplit(uri).getquerylist()

yields

[(u'genre', u'Acapella'), (u'Jazz Vocal', None), (u'Jazz', None)]

while

[(u'genre', u'Acapella;Jazz Vocal;Jazz')]

is what i would expect to get.
Would be great if this case could be handled by getquerylist()

@tkem tkem added the bug label Jul 9, 2015
@tkem
Copy link
Owner

tkem commented Jul 9, 2015

";" should be escaped just as "&" in uricompose.

@tkem tkem added this to the v1.0.1 milestone Jul 9, 2015
@tkem tkem closed this as completed in 11093e5 Jul 9, 2015
@tkem
Copy link
Owner

tkem commented Jul 9, 2015

@rawdlite: Thanks for reporting. Just uploaded a bugfix version to PyPi. Feel free to reopen this issue if the problem still persists.

@rawdlite
Copy link
Author

Looking good. Thanks for the fast fix.

@ilatypov
Copy link

It appears harmless to protect name, value pairs against other esoteric server-side parsers that could, in theory, use 2C, 21! 24$ 27' 28( 29) 2A* 3A: 40@ 2F/ 3F? for splitting the query into name=value pairs (sub-delims and special characters allowed by RFC 3986 in the query component). I suggested that as an issue in a standard, whatwg/url#74.

(On the other hand, I wonder why urisplit() decided to follow the HTML4 suggestion on splitting by semi-colons. One StackOverflow answer mentioned that HTML5 does not suggest this any more. Perhaps, urisplit() could have an option to control the splitting of query elements?)

@tkem
Copy link
Owner

tkem commented Nov 26, 2015

@ilatypov: Short answer: Because Python's standard urlparse.parse_qsl does so ;-)

Longer answer: I started uritools because I was unsatisfied how urlparse handled proprietary URI schemes as used in the Mopidy music server API, so I first tried to mimick urlparse, but stay true to RFC 3986. Over time, more and more features crept in, at some point also an option to specify the delimiter character(s) when splitting query components. For uritools v1.0, I tried to strip the interface down to the bare essentials, to keep maintenance costs low. If there's interest in this feature (I haven't gotten much feedback on uritools from outside the Mopidy community), I may think about it again, of course.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants