mirror of
https://github.com/beetbox/beets.git
synced 2025-12-15 21:14:19 +01:00
Fixed IndexError on reading embedded cover art with invalid cover type
This commit is contained in:
parent
268dcb0008
commit
b16898743d
3 changed files with 9 additions and 1 deletions
|
|
@ -326,7 +326,11 @@ class Image(object):
|
|||
self.data = data
|
||||
self.desc = desc
|
||||
if isinstance(type, int):
|
||||
type = list(ImageType)[type]
|
||||
try:
|
||||
type = list(ImageType)[type]
|
||||
except IndexError:
|
||||
log.warn("ignoring unknown image type index {}", type)
|
||||
type = ImageType.other
|
||||
self.type = type
|
||||
|
||||
@property
|
||||
|
|
|
|||
BIN
test/rsrc/image_unknown_type.mp3
Executable file
BIN
test/rsrc/image_unknown_type.mp3
Executable file
Binary file not shown.
|
|
@ -730,6 +730,10 @@ class MP3Test(ReadWriteTestBase, PartialTestMixin,
|
|||
'channels': 1,
|
||||
}
|
||||
|
||||
def test_unknown_apic_type(self):
|
||||
mediafile = self._mediafile_fixture('image_unknown_type')
|
||||
self.assertEqual(mediafile.images[0].type, ImageType.other)
|
||||
|
||||
|
||||
class MP4Test(ReadWriteTestBase, PartialTestMixin,
|
||||
ImageStructureTestMixin, unittest.TestCase):
|
||||
|
|
|
|||
Loading…
Reference in a new issue