mirror of
https://github.com/fergalmoran/picard.git
synced 2026-01-06 16:44:06 +00:00
PICARD-2814: Fix exception on loading embedded cover with invalid ID3 type
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
#
|
||||
# Copyright (C) 2007 Oliver Charles
|
||||
# Copyright (C) 2007, 2010-2011 Lukáš Lalinský
|
||||
# Copyright (C) 2007-2011, 2014, 2018-2023 Philipp Wolfer
|
||||
# Copyright (C) 2007-2011, 2014, 2018-2024 Philipp Wolfer
|
||||
# Copyright (C) 2011 Michael Wiencek
|
||||
# Copyright (C) 2011-2012, 2015 Wieland Hoffmann
|
||||
# Copyright (C) 2013-2015, 2018-2022 Laurent Monin
|
||||
@@ -461,9 +461,9 @@ class TagCoverArtImage(CoverArtImage):
|
||||
def __init__(self, file, tag=None, types=None, is_front=None,
|
||||
support_types=False, comment='', data=None,
|
||||
support_multi_types=False, id3_type=None):
|
||||
super().__init__(url=None, types=types, comment=comment, data=data, id3_type=id3_type)
|
||||
self.sourcefile = file
|
||||
self.tag = tag
|
||||
super().__init__(url=None, types=types, comment=comment, data=data, id3_type=id3_type)
|
||||
self.support_types = support_types
|
||||
self.support_multi_types = support_multi_types
|
||||
if is_front is not None:
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#
|
||||
# Picard, the next-generation MusicBrainz tagger
|
||||
#
|
||||
# Copyright (C) 2019, 2021-2022 Philipp Wolfer
|
||||
# Copyright (C) 2019, 2021-2024 Philipp Wolfer
|
||||
# Copyright (C) 2019-2021 Laurent Monin
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
@@ -41,6 +41,7 @@ from picard.coverart.utils import (
|
||||
Id3ImageType,
|
||||
types_from_id3,
|
||||
)
|
||||
from picard.file import File
|
||||
from picard.metadata import Metadata
|
||||
from picard.util import encode_filename
|
||||
from picard.util.filenaming import WinPathTooLong
|
||||
@@ -149,8 +150,13 @@ class CoverArtImageTest(PicardTestCase):
|
||||
image.id3_type = invalid_value
|
||||
|
||||
def test_init_invalid_id3_type(self):
|
||||
image = CoverArtImage(id3_type=255)
|
||||
self.assertEqual(image.id3_type, Id3ImageType.OTHER)
|
||||
cases = (
|
||||
(CoverArtImage, []),
|
||||
(TagCoverArtImage, [File('test.mp3')]),
|
||||
)
|
||||
for image_class, args in cases:
|
||||
image = image_class(*args, id3_type=255)
|
||||
self.assertEqual(image.id3_type, Id3ImageType.OTHER)
|
||||
|
||||
def test_compare_without_type(self):
|
||||
image1 = create_image(b'a', types=["front"])
|
||||
|
||||
Reference in New Issue
Block a user