Red Hat Bugzilla – Bug 1304353
tar.gz attachments are not accepted unless binary/octet stream is explicitly specified
Last modified: 2017-07-10 05:32:40 EDT
Description of problem:
When trying to add an attachment of type tar.gz with auto-detect file type option, I get an error: The content type binary/octet-stream is invalid. Valid types must be of the form foo/bar where foo is one of application, audio, image, message, model, multipart, text, video and bar must not contain any special characters (such as "=", "?", ...).
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. create tar.gz archive
2. try to add it to existing bug
3. set auto-detect file type
added attachment of type binary/octet stream
If you select "binary file" from the menu it sets the mime type to 'application/octet-stream' not 'binary/octet-stream'. 'binary/octet-stream' is for exactable binary files and we do not support attaching those.
If you select auto then it depends on what your browser is telling Bugzilla.
If your browser says the attachment is "application/octet-stream" then BZ will use File::MimeInfo to interrogate the file to determine it's mime type, which should be 'application/x-compressed-tar'.
If your browser says the attachment is anything else, Bugzilla trusts the browser and uses the supplied mime type.
So there are 3 possibilities here:
1: Your browser is telling BZ the mime type is 'binary/octet-stream' and BZ does the right things and says no.
2: Your browser is saying "application/octet-stream" and when BZ interrogates the file it has the wrong mime type and BZ does the right thing and says no.
3: Your browser is saying "application/octet-stream" and when BZ interrogates the file it has the right mime type and BZ does the wrong thing and says no.
We can only address number 3, but I'd need a tar ball that is triggering that as my tests work as expected.
$ perl -E 'use File::MimeInfo; say(mimetype("foo.tar.gz"));'
Tested adding foo.tar.gz to partner BZ using Firefox 48.0.1 on Fedora 24 at https://partner-bugzilla.redhat.com/show_bug.cgi?id=1369550 detected as application/x-gzip which means Firefox is supplying a different mime type to what is in the file, but it's a valid alternative.
OK, so this works now, closing.