After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 336448 - Handle 'application/octet-stream' gracefully for embedding in Firefox/Moz
Handle 'application/octet-stream' gracefully for embedding in Firefox/Moz
Status: RESOLVED FIXED
Product: evince
Classification: Core
Component: general
0.5.x
Other All
: Normal minor
: ---
Assigned To: Evince Maintainers
Evince Maintainers
: 318063 338297 340637 340754 342800 (view as bug list)
Depends on: 342818
Blocks:
 
 
Reported: 2006-03-29 07:57 UTC by Porges
Modified: 2006-05-25 06:06 UTC
See Also:
GNOME target: ---
GNOME version: 2.13/2.14


Attachments
A patch (6.47 KB, patch)
2006-03-29 11:07 UTC, Carlos Garcia Campos
needs-work Details | Review
Updated patch (7.08 KB, patch)
2006-03-30 12:14 UTC, Carlos Garcia Campos
none Details | Review
Patch against head (5.97 KB, patch)
2006-04-02 18:52 UTC, Carlos Garcia Campos
none Details | Review

Description Porges 2006-03-29 07:57:15 UTC
I have evince embedded in Firefox via MozEmbed. This works perfectly :)

However, sometimes the server will serve the PDF with the MIME type
'application/octet-stream'. This results in the error:

+----------------------------------------------------+
   Unhandled MIME type: 'application/octet-stream'
+----------------------------------------------------+

It would be nice if evince would auto-detect what the octet stream actually was,
or something similar. Then it would be (truely) perfect for embedding in Firefox.

Thanks for all the work so far!

Other information:
Comment 1 Porges 2006-03-29 07:58:32 UTC
Sorry, that should be MozPlugger, not MozEmbed.
Comment 2 Carlos Garcia Campos 2006-03-29 11:07:14 UTC
Created attachment 62288 [details] [review]
A patch

Here is a patch that fixes it. At the moment it works for PDF and PS.
Comment 3 Nickolay V. Shmyrev 2006-03-29 21:24:40 UTC
Carlos, gnome-vfs allows two types of mime type query as I remember - by extension and by contents, we just need to fallback to second with special gnome-vfs call, no need to add prefix masks to document types list.
Comment 4 Nickolay V. Shmyrev 2006-03-29 21:41:10 UTC
*** Bug 318063 has been marked as a duplicate of this bug. ***
Comment 5 Nickolay V. Shmyrev 2006-03-29 21:42:30 UTC
Another usecase for that problem - what will be if document with extension pdf contains Postscipt data. Probably we need to drop extension-based mime type at all and use more precise algorithm.
Comment 6 Carlos Garcia Campos 2006-03-29 21:55:58 UTC
I agree, I didn't know such a gnome_vfs function. I'll send an updated patch tomorrow. 
Comment 7 Carlos Garcia Campos 2006-03-30 10:33:47 UTC
I'm stupid, I already knew gnome_vfs_get_mime_type_for_data, I'm even using it for attachments :-P 
Unfortunately that function returns 'application/octet-stream' for pdf files and 'text/plain' for postscript files. So, maybe my approach is a good solution and faster. Anyway, I'm going to prepare a new patch with a better algorithm. 
Comment 8 Carlos Garcia Campos 2006-03-30 12:14:38 UTC
Created attachment 62382 [details] [review]
Updated patch

Here is a new patch. Using always data information to get the mime-type could be really slow (specially remote files) and having a file without extension or with a wrong extension is indeed an exception. So, I think we should try to get the mime-type from the extension, since it's the fastest way, and if it fails then try with data information. The only situation not covered is a pdf file with a .ps extension or something like that, but those cases are more than strange
Comment 9 Carlos Garcia Campos 2006-04-02 18:52:30 UTC
Created attachment 62621 [details] [review]
Patch against head

Here is an updated patch against current cvs head.
Comment 10 Nickolay V. Shmyrev 2006-04-02 23:26:39 UTC
Should be fixed in HEAD, thanks to all.
Comment 11 Nickolay V. Shmyrev 2006-04-13 04:48:01 UTC
*** Bug 338297 has been marked as a duplicate of this bug. ***
Comment 12 Nickolay V. Shmyrev 2006-05-04 15:39:15 UTC
*** Bug 340637 has been marked as a duplicate of this bug. ***
Comment 13 Nickolay V. Shmyrev 2006-05-05 19:50:19 UTC
*** Bug 340754 has been marked as a duplicate of this bug. ***
Comment 14 Joachim Frieben 2006-05-18 11:39:58 UTC
Upgrading to "evince" version 0.5.3 has not had the expected effect for me. Check the following link:

    http://de.arxiv.org/pdf/gr-qc/0605101

which links to an online preprint server. One gets the usual "Unhandled MIME type: 'application/octet-stream'" message. My browser is "epiphany" version 2.15.2 based upon the "xulrunner" 1.8.0.4 (CVS) backend.
Comment 15 Carlos Garcia Campos 2006-05-18 13:07:57 UTC
It doesn't work for me too, I think it could be a gnome-vfs bug. 
Comment 16 Nickolay V. Shmyrev 2006-05-24 11:59:29 UTC
*** Bug 342800 has been marked as a duplicate of this bug. ***
Comment 17 Nickolay V. Shmyrev 2006-05-24 15:40:32 UTC
That should be gnomevfs bug, upgrade to FC5 broke my version also.
Comment 18 Nickolay V. Shmyrev 2006-05-24 15:40:59 UTC
gnomevfs-info also incorrectly show mime type now
Comment 19 Nickolay V. Shmyrev 2006-05-24 16:08:44 UTC
I've just filed bug 342818 about that
Comment 20 Nickolay V. Shmyrev 2006-05-25 06:06:30 UTC
Upgrade to shared-mime-info HEAD will fix the problem.