File tree Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -2417,4 +2417,30 @@ mod tests {
2417
2417
assert_eq ! ( composers. next( ) , Some ( "B" ) ) ;
2418
2418
assert_eq ! ( composers. next( ) , None )
2419
2419
}
2420
+
2421
+ #[ test]
2422
+ fn trim_end_nulls_when_reading_frame_content ( ) {
2423
+ // Issue #273
2424
+ // Tag written by mid3v2. All frames contain null-terminated UTF-8 text
2425
+ let tag = read_tag ( "tests/tags/assets/id3v2/trailing_nulls.id3v24" ) ;
2426
+
2427
+ // Verify that each different frame type no longer has null terminator
2428
+ let artist = tag. get_text ( & FrameId :: Valid ( Cow :: Borrowed ( "TPE1" ) ) ) ;
2429
+ assert_eq ! ( artist. unwrap( ) , "Artist" ) ;
2430
+
2431
+ let writer = tag. get_user_text ( "Writer" ) ;
2432
+ assert_eq ! ( writer. unwrap( ) , "Writer" ) ;
2433
+
2434
+ let lyrics = & tag. unsync_text ( ) . next ( ) . unwrap ( ) . content ;
2435
+ assert_eq ! ( lyrics, "Lyrics to the song" ) ;
2436
+
2437
+ let comment = tag. comment ( ) . unwrap ( ) ;
2438
+ assert_eq ! ( comment, "Comment" ) ;
2439
+
2440
+ let url_frame = tag. get ( & FrameId :: Valid ( Cow :: Borrowed ( "WXXX" ) ) ) . unwrap ( ) ;
2441
+ let FrameValue :: UserUrl ( url) = & url_frame. value else {
2442
+ panic ! ( "Expected a UserUrl" )
2443
+ } ;
2444
+ assert_eq ! ( url. content, "https://www.myfanpage.com" ) ;
2445
+ }
2420
2446
}
You can’t perform that action at this time.
0 commit comments