Fix crash on mismatching quotation (fixes #137)
This commit is contained in:
parent
904adc938e
commit
219e723974
@ -31,6 +31,9 @@ v0.7.0 (in development)
|
|||||||
- Fix ``gst.LinkError`` which appeared when using newer versions of GStreamer,
|
- Fix ``gst.LinkError`` which appeared when using newer versions of GStreamer,
|
||||||
e.g. on Ubuntu 12.04 Alpha. (Fixes: :issue:`144`)
|
e.g. on Ubuntu 12.04 Alpha. (Fixes: :issue:`144`)
|
||||||
|
|
||||||
|
- Fix crash on mismatching quotation in ``list`` MPD queries. (Fixes:
|
||||||
|
:issue:`137`)
|
||||||
|
|
||||||
|
|
||||||
v0.6.1 (2011-12-28)
|
v0.6.1 (2011-12-28)
|
||||||
===================
|
===================
|
||||||
|
|||||||
@ -189,8 +189,14 @@ def _list_build_query(field, mpd_query):
|
|||||||
"""Converts a ``list`` query to a Mopidy query."""
|
"""Converts a ``list`` query to a Mopidy query."""
|
||||||
if mpd_query is None:
|
if mpd_query is None:
|
||||||
return {}
|
return {}
|
||||||
# shlex does not seem to be friends with unicode objects
|
try:
|
||||||
tokens = shlex.split(mpd_query.encode('utf-8'))
|
# shlex does not seem to be friends with unicode objects
|
||||||
|
tokens = shlex.split(mpd_query.encode('utf-8'))
|
||||||
|
except ValueError as error:
|
||||||
|
if error.message == 'No closing quotation':
|
||||||
|
raise MpdArgError(u'Invalid unquoted character', command=u'list')
|
||||||
|
else:
|
||||||
|
raise error
|
||||||
tokens = [t.decode('utf-8') for t in tokens]
|
tokens = [t.decode('utf-8') for t in tokens]
|
||||||
if len(tokens) == 1:
|
if len(tokens) == 1:
|
||||||
if field == u'album':
|
if field == u'album':
|
||||||
|
|||||||
@ -146,3 +146,19 @@ class IssueGH113RegressionTest(protocol.BaseTestCase):
|
|||||||
self.sendRequest(
|
self.sendRequest(
|
||||||
r'listplaylistinfo "all lart spotify:track:\\w\\{22\\} pastes"')
|
r'listplaylistinfo "all lart spotify:track:\\w\\{22\\} pastes"')
|
||||||
self.assertInResponse('OK')
|
self.assertInResponse('OK')
|
||||||
|
|
||||||
|
|
||||||
|
class IssueGH137RegressionTest(protocol.BaseTestCase):
|
||||||
|
"""
|
||||||
|
The issue: https://github.com/mopidy/mopidy/issues/137
|
||||||
|
|
||||||
|
How to reproduce:
|
||||||
|
|
||||||
|
- Send "list" query with mismatching quotes
|
||||||
|
"""
|
||||||
|
|
||||||
|
def test(self):
|
||||||
|
self.sendRequest(u'list Date Artist "Anita Ward" '
|
||||||
|
u'Album "This Is Remixed Hits - Mashups & Rare 12" Mixes"')
|
||||||
|
|
||||||
|
self.assertInResponse('ACK [2@0] {list} Invalid unquoted character')
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user