mirror of
https://github.com/beetbox/beets.git
synced 2026-02-22 15:22:42 +01:00
pass bytestringed names to fnmatch_all()
Due to `syspath`, fnmatch ends up comparing strings to bytes, so we must make sure they are bytes. Fixes #2124
This commit is contained in:
parent
e7428972ca
commit
f87486c1fa
1 changed files with 2 additions and 1 deletions
|
|
@ -267,7 +267,8 @@ def prune_dirs(path, root=None, clutter=('.DS_Store', 'Thumbs.db')):
|
|||
# Directory gone already.
|
||||
continue
|
||||
clutter = [bytestring_path(c) for c in clutter]
|
||||
if fnmatch_all(os.listdir(directory), clutter):
|
||||
match_paths = [bytestring_path(d) for d in os.listdir(directory)]
|
||||
if fnmatch_all(match_paths, clutter):
|
||||
# Directory contains only clutter (or nothing).
|
||||
try:
|
||||
shutil.rmtree(directory)
|
||||
|
|
|
|||
Loading…
Reference in a new issue