Skip to content

Commit b5f1f99

Browse files
committed
Merge branch 'master' into RobustCaseSensitiveDetection
# Conflicts: # docs/changelog.rst
2 parents 5832e87 + 6bae814 commit b5f1f99

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

beets/library.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,18 +93,20 @@ def match(self, item):
9393
return (path == self.file_path) or path.startswith(self.dir_path)
9494

9595
def col_clause(self):
96-
file_blob = buffer(self.file_path)
97-
9896
if self.case_sensitive:
97+
file_blob = buffer(self.file_path)
9998
dir_blob = buffer(self.dir_path)
10099
return '({0} = ?) || (substr({0}, 1, ?) = ?)'.format(self.field), \
101100
(file_blob, len(dir_blob), dir_blob)
102101

103102
escape = lambda m: self.escape_char + m.group(0)
104103
dir_pattern = self.escape_re.sub(escape, self.dir_path)
105104
dir_blob = buffer(dir_pattern + b'%')
106-
return '({0} = ?) || ({0} LIKE ? ESCAPE ?)'.format(self.field), \
107-
(file_blob, dir_blob, self.escape_char)
105+
file_pattern = self.escape_re.sub(escape, self.file_path)
106+
file_blob = buffer(file_pattern)
107+
return '({0} LIKE ? ESCAPE ?) || ({0} LIKE ? ESCAPE ?)'.format(
108+
self.field), (file_blob, self.escape_char, dir_blob,
109+
self.escape_char)
108110

109111

110112
# Library-specific field types.

docs/changelog.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ Fixes:
4747
encounters an error. :bug:`1592`
4848
* The check whether the file system is case sensitive or not could lead to
4949
wrong results. It is much more robust now.
50+
* Case-insensitive path queries might have returned nothing because of a
51+
wrong SQL query.
5052

5153

5254
1.3.14 (August 2, 2015)

0 commit comments

Comments
 (0)