Bug 1304353 - tar.gz attachments are not accepted unless binary/octet stream is explicitly specified
Summary: tar.gz attachments are not accepted unless binary/octet stream is explicitly ...
Keywords:
Status: CLOSED WORKSFORME
Alias: None
Product: Bugzilla
Classification: Community
Component: Attachments/Requests
Version: 4.4
Hardware: Unspecified
OS: Unspecified
unspecified
urgent
Target Milestone: ---
Assignee: PnT DevOps Devs
QA Contact: tools-bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-02-03 12:00 UTC by Petr Matyáš
Modified: 2017-07-10 09:32 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-07-10 09:32:40 UTC
Embargoed:


Attachments (Terms of Use)

Description Petr Matyáš 2016-02-03 12:00:36 UTC
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):
4.4.11046.4

How reproducible:
always

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 23:31:04 UTC
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"));'
application/x-compressed-tar

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 09:32:40 UTC
OK, so this works now, closing.


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