Skip to content

Commit

Permalink
Fixed can't concat str to byte inside move
Browse files Browse the repository at this point in the history
`os.path.basename` returns the same type that was used.

So, I have no guarantee that I needed here: `b'.''` or `'.'`.

Let use something universal ;)
  • Loading branch information
catap committed Dec 8, 2021
1 parent 7364437 commit 56f9ca4
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions beets/util/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -495,9 +495,10 @@ def move(path, dest, replace=False):
try:
os.replace(path, dest)
except OSError:
tmp = tempfile.mktemp(suffix='.beets',
prefix=py3_path(b'.' + os.path.basename(dest)),
dir=py3_path(os.path.dirname(dest)))
suffix = py3_path('.beets')
prefix = py3_path('.') + os.path.basename(py3_path(dest))
dir = os.path.dirname(py3_path(dest))
tmp = tempfile.mktemp(suffix=suffix, prefix=prefix, dir=dir)
tmp = syspath(tmp)
try:
shutil.copyfile(path, tmp)
Expand Down

0 comments on commit 56f9ca4

Please sign in to comment.