GNOME Bugzilla – Bug 562143
Evince a bit naive about filetypes
Last modified: 2008-12-21 01:02:30 UTC
1. Get or create a CBZ (zip) comic book archive 2. Rename the file to .cbr Evince tells you it can't handle zip files, when it should know it's a .cbz comic book.
Fixed in svn trunk. Thanks for reporting.
There is an error with cbz files. The function ev_file_get_mime_type returns "application/zip" instead of "application/x-zip". The direct workaround is to add this string to the conditional expression for the cbz files, it doesn't hurts to anybody, and, of course, to report this error. As far I know, I _think_ I can back track this bug until the g_content_type_guess at the file gcontenttype.c from GLib. Can anyone be so kind of checking it out and report the error ? :-)
application/x-zip doesn't exist anywhere in shared-mime-info, so it's unlikely to be a glib issue.
Thank you Bastien, you're very quick :-). Awesome !!! OK, so then I guess is enough to change "application/x-zip" for "application/zip" in the conditional expression for the cbz files. the silly "patch" I propose is then: Index: backend/comics/comics-document.c =================================================================== --- backend/comics/comics-document.c (revisión: 3287) +++ backend/comics/comics-document.c (copia de trabajo) @@ -131,7 +131,7 @@ g_strdup_printf ("unrar vb -c- -- %s", quoted_file); comics_document->regex_arg = FALSE; } else if (!strcmp (mime_type, "application/x-cbz") || - !strcmp (mime_type, "application/x-zip")) { + !strcmp (mime_type, "application/zip")) { comics_document->extract_command = g_strdup ("unzip -p -C"); list_files_command =
I find a similar issue with the cb7 files. In the same way, I think is sensible to add the string "application/x-7z-compressed" -the mime type for 7z files- to its conditional expression. However, the mime type detected for the application is "application/octet-stream". I don't understand why.
That's because the definition of the application/x-7z-compressed mime-type doesn't have any magic.
(In reply to comment #3) > application/x-zip doesn't exist anywhere in shared-mime-info, so it's unlikely > to be a glib issue. > Yes, it's indeed my fault :-P (In reply to comment #4) > Thank you Bastien, you're very quick :-). Awesome !!! > > OK, so then I guess is enough to change "application/x-zip" for > "application/zip" in the conditional expression for the cbz files. > > the silly "patch" I propose is then: > > Index: backend/comics/comics-document.c > =================================================================== > --- backend/comics/comics-document.c (revisión: 3287) > +++ backend/comics/comics-document.c (copia de trabajo) > @@ -131,7 +131,7 @@ > g_strdup_printf ("unrar vb -c- -- %s", quoted_file); > comics_document->regex_arg = FALSE; > } else if (!strcmp (mime_type, "application/x-cbz") || > - !strcmp (mime_type, "application/x-zip")) { > + !strcmp (mime_type, "application/zip")) { > comics_document->extract_command = > g_strdup ("unzip -p -C"); > list_files_command = > Applied, thanks! :-)
(In reply to comment #6) > That's because the definition of the application/x-7z-compressed mime-type > doesn't have any magic. I added magic for 7z files to shared-mime-info this morning.
Thank you Bastien, you're my man :-) I built evince with jhbuild, and, by now, the mime type detected by evince is "application/octet-stream". Is the change commited on the svn ?
Another problem with the cb7 support is that cb7 files are not shown in the File Chooser Dialog. I guess that this is because mime type for cb7 files [1] is not detected correctly. [1] I don't know which is the correct name of the mime type for cb7 files, evince file chooser dialog shows (or tries to show) files with the mime type "application/x-cb7". However, the property tab of my system _ubuntu-8.04_ indicates that cb7 files are of mime type "application/x-extension-cb7" and this is confusing to me. PS: Bastien, I'm a newbie and I don't understand very well all this shared-mime-inf stuff. JHbuild download the lastest published version, shared-mime-info-0.51.
shared-mime-info 0.51 is the latest release, but you'd need to get the CVS version to get it working. As for cb7 files, they're not in shared-mime-info. Feel free to file a bug at bugs.freedesktop.org and I'll add it there.
I've opened a bug for cb7 support https://bugs.freedesktop.org/show_bug.cgi?id=18887 However, the fix for cb7 support needs more work because the command for listing the files doesn't work. I'll try to fix it in the following days if I'don't go out too much :-)
I've submitted a patch for bug 18887 in shared-mime-info (it haven't be applied yet). With this patch and the one by Bastien Nocera we have everything in shared-mime-info for the comic book backend. We only need to add this small patch for cb7 files to have the mime support for all the comic book formats: =================================================================== --- backend/comics/comics-document.c (revisión: 3295) +++ backend/comics/comics-document.c (copia de trabajo) @@ -137,7 +137,8 @@ list_files_command = g_strdup_printf ("zipinfo -1 -- %s", quoted_file); comics_document->regex_arg = TRUE; - } else if (!strcmp (mime_type, "application/x-cb7")) { + } else if (!strcmp (mime_type, "application/x-cb7") || + !strcmp (mime_type, "application/x-7z-compressed")) { comics_document->extract_command = g_strdup ("7zr x -so"); list_files_command = PS: Now we have to fix the rar (bug 552074) and 7z support. I will open a bug report for the 7z problem I've detected.
Hi, Bastien has applied the patch for bug 18887 for share-mime-info (thank you!) and the only thing left to fix the mime-type support for cb7 files is to apply a pretty simple patch. I attach the patch (I missed a line when I quoted on the previous comment).
Created attachment 125045 [details] [review] Fix cb7 mime-type support in comics backend
Related (sort of): Bug 565174 – Evince crashes with cb7 files http://bugzilla.gnome.org/show_bug.cgi?id=565174