ruby-mp3info icon indicating copy to clipboard operation
ruby-mp3info copied to clipboard

add_picture method does not work with ruby 1.8

Open justindossey opened this issue 11 years ago • 2 comments

String#force_encoding and Regexp::FIXEDENCODING don't work with ruby 1.8, and both are used in ID3V2::add_picture.

Furthermore, reading an id3v2 tag with an APIC frame fails because iconv blows up on the binary data in the frame. AFAICT, we shouldn't even attempt to decode that data.

Finally, the mime type you set is "jpg" for JPEG, but the spec at http://id3.org/id3v2.3.0#Attached_picture says it should be "image/jpeg" not "image/jpg".

Example exception on reading an mp3 file with an APIC frame: *** ERROR: "\376\377\000\000\377\376E\000p\000i\000s\000o\000"...; ... ruby-mp3info-0.8.1/lib/mp3info/extension_modules.rb:67:in `iconv'

(same issue occurs with 0.8.2)

I would suggest that if options[:mime] is passed in, you can skip the image format detection fancy stuff.

justindossey avatar Dec 05 '13 00:12 justindossey

We should add to requirements that Ruby 1.8 is unsupported for image tag

testbrian avatar Oct 01 '14 21:10 testbrian

you're right about image/jpg being wrong, however in practice it's never caused a problem in reading tags. But can be fixed

testbrian avatar Oct 01 '14 21:10 testbrian