mirror of
https://github.com/beetbox/beets.git
synced 2026-01-14 20:24:36 +01:00
bpd: fix crash w/ unicode extensions (GC-439)
This commit is contained in:
parent
49a6b993d3
commit
ef248576f0
3 changed files with 11 additions and 0 deletions
|
|
@ -1135,6 +1135,9 @@ class Library(BaseLibrary):
|
|||
|
||||
# Preserve extension.
|
||||
_, extension = pathmod.splitext(item.path)
|
||||
if fragment:
|
||||
# Outputting Unicode.
|
||||
extension = extension.decode('utf8', 'ignore')
|
||||
subpath += extension.lower()
|
||||
|
||||
if fragment:
|
||||
|
|
|
|||
|
|
@ -27,6 +27,8 @@ Changelog
|
|||
disagree.
|
||||
* Fix a bug that caused the :doc:`/plugins/lastgenre` and other plugins not to
|
||||
modify files' tags even when they successfully change the database.
|
||||
* Fix a VFS bug leading to a crash in the :doc:`/plugins/bpd` when files had
|
||||
non-ASCII extensions.
|
||||
|
||||
.. _Tomahawk resolver: http://beets.radbox.org/blog/tomahawk-resolver.html
|
||||
|
||||
|
|
|
|||
|
|
@ -442,6 +442,12 @@ class DestinationTest(unittest.TestCase):
|
|||
finally:
|
||||
sys.getfilesystemencoding = oldfunc
|
||||
|
||||
def test_unicode_extension_in_fragment(self):
|
||||
self.lib.path_formats = [('default', u'foo')]
|
||||
self.i.path = util.bytestring_path(u'bar.caf\xe9')
|
||||
dest = self.lib.destination(self.i, platform='linux2', fragment=True)
|
||||
self.assertEqual(dest, u'foo.caf\xe9')
|
||||
|
||||
class PathFormattingMixin(object):
|
||||
"""Utilities for testing path formatting."""
|
||||
def _setf(self, fmt):
|
||||
|
|
|
|||
Loading…
Reference in a new issue