mirror of
https://github.com/fergalmoran/picard.git
synced 2026-01-07 09:04:29 +00:00
PICARD-2307: Fix ValueError for Vorbis when deleting invalid tags
This commit is contained in:
@@ -321,7 +321,7 @@ class VCommentFile(File):
|
||||
"""Remove the tags from the file that were deleted in the UI"""
|
||||
for tag in metadata.deleted_tags:
|
||||
real_name = self._get_tag_name(tag)
|
||||
if real_name and real_name in tags:
|
||||
if is_valid_key(real_name) and real_name in tags:
|
||||
if real_name in ('performer', 'comment'):
|
||||
parts = tag.split(':', 1)
|
||||
if len(parts) == 2:
|
||||
|
||||
@@ -184,6 +184,15 @@ class CommonVorbisTests:
|
||||
self.assertNotIn('tracktotal', loaded_metadata)
|
||||
self.assertNotIn('totaltracks', loaded_metadata)
|
||||
|
||||
@skipUnlessTestfile
|
||||
def test_delete_invalid_tagname(self):
|
||||
# Deleting tags that are not valid Vorbis tag names must not trigger
|
||||
# an error
|
||||
for invalid_tag in INVALID_KEYS:
|
||||
metadata = Metadata()
|
||||
del metadata[invalid_tag]
|
||||
save_metadata(self.filename, metadata)
|
||||
|
||||
|
||||
class FLACTest(CommonVorbisTests.VorbisTestCase):
|
||||
testfile = 'test.flac'
|
||||
|
||||
Reference in New Issue
Block a user