mirror of
https://github.com/beetbox/beets.git
synced 2025-12-15 13:07:09 +01:00
fix #517: BytesQuery accepts unicode strings
This commit is contained in:
parent
baa55bea1b
commit
0d4698a8af
1 changed files with 5 additions and 1 deletions
|
|
@ -151,7 +151,11 @@ class BytesQuery(MatchQuery):
|
|||
# Use a buffer representation of the pattern for SQLite
|
||||
# matching. This instructs SQLite to treat the blob as binary
|
||||
# rather than encoded Unicode.
|
||||
if isinstance(self.pattern, bytes):
|
||||
if isinstance(self.pattern, basestring):
|
||||
# Implicitly coerce Unicode strings to their bytes
|
||||
# equivalents.
|
||||
if isinstance(self.pattern, unicode):
|
||||
self.pattern = self.pattern.encode('utf8')
|
||||
self.buf_pattern = buffer(self.pattern)
|
||||
elif isinstance(self.pattern, buffer):
|
||||
self.buf_pattern = self.pattern
|
||||
|
|
|
|||
Loading…
Reference in a new issue