Bug 1304353 - tar.gz attachments are not accepted unless binary/octet stream is explicitly specified
tar.gz attachments are not accepted unless binary/octet stream is explicitly ...
Product: Bugzilla
Classification: Community
Component: Attachments/Requests (Show other bugs)
Unspecified Unspecified
unspecified Severity urgent (vote)
: ---
: ---
Assigned To: PnT DevOps Devs
Depends On:
  Show dependency treegraph
Reported: 2016-02-03 07:00 EST by Petr Matyáš
Modified: 2017-07-10 05:32 EDT (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2017-07-10 05:32:40 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Petr Matyáš 2016-02-03 07:00:36 EST
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):

How reproducible:

Steps to Reproduce:
1. create tar.gz archive
2. try to add it to existing bug
3. set auto-detect file type
4. submit

Actual results:
error message

Expected results:
added attachment of type binary/octet stream

Additional info:
Comment 1 Jeff Fearn 2016-09-07 19:31:04 EDT
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.
Comment 3 Petr Matyáš 2017-07-10 05:32:40 EDT
OK, so this works now, closing.

Note You need to log in before you can comment on or make changes to this bug.