mirror of
https://github.com/beetbox/beets.git
synced 2026-02-14 19:35:43 +01:00
Fix thumbnail plugin pathlib bug (#3360)
PathlibURI.uri() would fail if given a path as bytes instead of as string. Co-authored-by: Jacob Pavlock <jtpavlock@gmail.com>
This commit is contained in:
parent
05516f9503
commit
dc7e433768
3 changed files with 13 additions and 1 deletions
|
|
@ -224,7 +224,7 @@ class PathlibURI(URIGetter):
|
|||
name = "Python Pathlib"
|
||||
|
||||
def uri(self, path):
|
||||
return PurePosixPath(path).as_uri()
|
||||
return PurePosixPath(util.py3_path(path)).as_uri()
|
||||
|
||||
|
||||
def copy_c_string(c_string):
|
||||
|
|
|
|||
|
|
@ -139,6 +139,9 @@ New features:
|
|||
* :doc:`/plugins/lyrics`: Fix a bug in the heuristic for detecting valid
|
||||
lyrics in the Google source of the lyrics plugin
|
||||
:bug:`2969`
|
||||
* :doc:`/plugins/thumbnails`: Fix a bug where pathlib expected a string instead
|
||||
of bytes for a path.
|
||||
:bug:`3360`
|
||||
|
||||
Fixes:
|
||||
|
||||
|
|
|
|||
|
|
@ -284,6 +284,15 @@ class ThumbnailsTest(unittest.TestCase, TestHelper):
|
|||
u'file:///music/%EC%8B%B8%EC%9D%B4')
|
||||
|
||||
|
||||
class TestPathlibURI():
|
||||
"""Test PathlibURI class"""
|
||||
def test_uri(self):
|
||||
test_uri = PathlibURI()
|
||||
|
||||
# test it won't break if we pass it bytes for a path
|
||||
test_uri.uri(b'/')
|
||||
|
||||
|
||||
def suite():
|
||||
return unittest.TestLoader().loadTestsFromName(__name__)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue