Vorbis Comments: Don't rely on the case of METADATA_BLOCK_PICTURE

closes: #60
This commit is contained in:
Serial 2022-08-03 08:33:39 -04:00
parent 81a8a616c1
commit f3a7e4d5f1
No known key found for this signature in database
GPG key ID: DA95198DC17C4568
4 changed files with 11 additions and 1 deletions

View file

@ -22,6 +22,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- **ID3v2**: `LanguageFrame`'s `lang` field has changed type - `String` -> `[u8; 3]`
- **MP3**: Renamed `MP3File` -> `MPEGFile`
- **MP4**: `Atom::data` will now return all values
- **Vorbis Comments**: Recognize lowercase `METADATA_BLOCK_PICTURE` as a picture
## [0.7.3] - 2022-07-22

View file

@ -87,7 +87,7 @@ where
// Make sure there was a separator present, otherwise just move on
if let Some(value) = comment_split.next() {
match key {
"METADATA_BLOCK_PICTURE" => tag
k if k.eq_ignore_ascii_case("METADATA_BLOCK_PICTURE") => tag
.pictures
.push(Picture::from_flac_bytes(value.as_bytes(), true)?),
// The valid range is 0x20..=0x7D not including 0x3D

View file

@ -623,4 +623,13 @@ mod tests {
let tag_bytes = std::fs::read("tests/tags/assets/zero.vorbis").unwrap();
let _ = read_tag(&tag_bytes);
}
#[test]
fn issue_60() {
let tag_bytes = std::fs::read("tests/tags/assets/issue_60.vorbis").unwrap();
let tag = read_tag(&tag_bytes);
assert_eq!(tag.pictures().len(), 1);
assert!(tag.items.is_empty());
}
}

Binary file not shown.