Use bytes for destination base name
This is mostly "defensive programming": clients *should* only call this
on bytestring paths, but just in case this gets called on a Unicode
string path, we should now not crash.
@@ -496,8 +496,9 @@ def move(path, dest, replace=False):
os.replace(path, dest)
except OSError:
# Copy the file to a temporary destination.
+ base = os.path.basename(bytestring_path(dest))
tmp = tempfile.NamedTemporaryFile(suffix=b'.beets',
- prefix=b'.' + os.path.basename(dest),
+ prefix=b'.' + base,
dir=os.path.dirname(dest),
delete=False)
try:
