diff --git a/picard/formats/vorbis.py b/picard/formats/vorbis.py index da3274ba5..ecbedade5 100644 --- a/picard/formats/vorbis.py +++ b/picard/formats/vorbis.py @@ -72,7 +72,7 @@ def is_valid_key(key): Valid characters for Vorbis comment field names are ASCII 0x20 through 0x7D, 0x3D ('=') excluded. """ - return INVALID_CHARS.search(key) is None + return key and INVALID_CHARS.search(key) is None def flac_sort_pics_after_tags(metadata_blocks): diff --git a/test/formats/test_vorbis.py b/test/formats/test_vorbis.py index 214b9f5b8..400302443 100644 --- a/test/formats/test_vorbis.py +++ b/test/formats/test_vorbis.py @@ -67,6 +67,7 @@ VALID_KEYS = [ ] INVALID_KEYS = [ + '', 'invalid=key', 'invalid\x19key', 'invalid~key', @@ -91,7 +92,7 @@ class CommonVorbisTests: supports_tag = self.format.supports_tag for key in VALID_KEYS + list(TAGS.keys()): self.assertTrue(supports_tag(key), '%r should be supported' % key) - for key in INVALID_KEYS + ['']: + for key in INVALID_KEYS: self.assertFalse(supports_tag(key), '%r should be unsupported' % key) @skipUnlessTestfile