GNOME Bugzilla – Bug 336448
Handle 'application/octet-stream' gracefully for embedding in Firefox/Moz
Last modified: 2006-05-25 06:06:30 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:
Sorry, that should be MozPlugger, not MozEmbed.
Created attachment 62288 [details] [review] A patch Here is a patch that fixes it. At the moment it works for PDF and PS.
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.
*** Bug 318063 has been marked as a duplicate of this bug. ***
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.
I agree, I didn't know such a gnome_vfs function. I'll send an updated patch tomorrow.
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.
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
Created attachment 62621 [details] [review] Patch against head Here is an updated patch against current cvs head.
Should be fixed in HEAD, thanks to all.
*** Bug 338297 has been marked as a duplicate of this bug. ***
*** Bug 340637 has been marked as a duplicate of this bug. ***
*** Bug 340754 has been marked as a duplicate of this bug. ***
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.
It doesn't work for me too, I think it could be a gnome-vfs bug.
*** Bug 342800 has been marked as a duplicate of this bug. ***
That should be gnomevfs bug, upgrade to FC5 broke my version also.
gnomevfs-info also incorrectly show mime type now
I've just filed bug 342818 about that
Upgrade to shared-mime-info HEAD will fix the problem.