Predonditions: * Have a flac+ogg file -> my_flac.ogg Expected behavior: Using GnomeVFS to guess the mimetype of a flac+ogg file using the magic number says "audio/x-flac+ogg" Current behavior: Using GnomeVFS to guess the mimetype of a flac+ogg file using the magic number says "application/ogg"
Created attachment 14317 [details] Sample flac+ogg audio file
Created attachment 14318 [details] Simple program to guess a file mime type using GnomeVFS
Created attachment 14319 [details] [review] Patch that fixes the mime guessing through the magic tag for flac+ogg files The offset should be 37, not 28. See http://flac.sourceforge.net/ogg_mapping.html
I think it would be better to check at offset 28 for the 0x7f FLAC marker instead (so "\177FLAC" I guess?) (IIRC there are also other flac-in-ogg variants with slightly incorrect mapping out there, some of them with just a 4-byte 'fLaC' as the first ogg packet/page; this is just from memory, but seems to match what's currently checked for). In short: you should probably check for both if you want to be on the safe side.
Created attachment 14485 [details] [review] Patch that fixes the mime guessing through the magic tag for flac+ogg files In the end, I think you are right, probably, checking for the "\177FLAC" with an offset of 28 would make the same and should be a little bit faster, and keeping the old one would be good for backward compatibility, so this is a new version of the proposed patch. Thanks for your tips!! :)
(In reply to comment #5) > Created an attachment (id=14485) [details] > Patch that fixes the mime guessing through the magic tag for flac+ogg files > > In the end, I think you are right, probably, checking for the "\177FLAC" with > an offset of 28 would make the same and should be a little bit faster, and > keeping the old one would be good for backward compatibility, so this is a new > version of the proposed patch. Patches should be against the .in file, not the generated file... * freedesktop.org.xml.in: Add another magic pattern for FLAC files inside Ogg, patch by Andrés Gómez García <agomez@igalia.com> (Closes: #14501)
My fault, next time I will remember ;) Thanks for the advice!
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.