Skip to content

Commit

Permalink
pass bytestringed names to fnmatch_all()
Browse files Browse the repository at this point in the history
Due to `syspath`, fnmatch ends up comparing strings to bytes, so we must
make sure they are bytes. Fixes #2124
  • Loading branch information
Johnny Robeson committed Jul 21, 2016
1 parent e742897 commit f87486c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion beets/util/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit f87486c

Please sign in to comment.