evince r3280 - in trunk: . backend/comics
- From: carlosgc svn gnome org
- To: svn-commits-list gnome org
- Subject: evince r3280 - in trunk: . backend/comics
- Date: Sat, 29 Nov 2008 12:09:18 +0000 (UTC)
Author: carlosgc
Date: Sat Nov 29 12:09:17 2008
New Revision: 3280
URL: http://svn.gnome.org/viewvc/evince?rev=3280&view=rev
Log:
2008-11-29 Carlos Garcia Campos <carlosgc gnome org>
* backend/comics/comics-document.c: (comics_document_load):
Do not trust file extensions when getting the command needed to
uncompress comic documents. Fixes bug #562143.
Modified:
trunk/ChangeLog
trunk/backend/comics/comics-document.c
Modified: trunk/backend/comics/comics-document.c
==============================================================================
--- trunk/backend/comics/comics-document.c (original)
+++ trunk/backend/comics/comics-document.c Sat Nov 29 12:09:17 2008
@@ -109,10 +109,8 @@
{
ComicsDocument *comics_document = COMICS_DOCUMENT (document);
GSList *supported_extensions;
- GFile *file;
- GFileInfo *file_info;
gchar *list_files_command = NULL, *std_out, *quoted_file;
- const gchar *mime_type = NULL;
+ gchar *mime_type;
gchar **cbr_files;
gboolean success;
int i, retval;
@@ -121,24 +119,19 @@
g_return_val_if_fail (comics_document->archive != NULL, FALSE);
quoted_file = g_shell_quote (comics_document->archive);
- file = g_file_new_for_uri (uri);
- file_info = g_file_query_info (file,
- G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE,
- 0, NULL, NULL);
- if (file_info != NULL) {
- mime_type = g_file_info_get_content_type (file_info);
- }
- g_object_unref (file);
+ mime_type = ev_file_get_mime_type (uri, FALSE, NULL);
/* FIXME, use proper cbr/cbz mime types once they're
* included in shared-mime-info */
- if (!strcmp (mime_type, "application/x-cbr")) {
+ if (!strcmp (mime_type, "application/x-cbr") ||
+ !strcmp (mime_type, "application/x-rar")) {
comics_document->extract_command =
g_strdup ("unrar p -c- -ierr");
list_files_command =
g_strdup_printf ("unrar vb -c- -- %s", quoted_file);
comics_document->regex_arg = FALSE;
- } else if (!strcmp (mime_type, "application/x-cbz")) {
+ } else if (!strcmp (mime_type, "application/x-cbz") ||
+ !strcmp (mime_type, "application/x-zip")) {
comics_document->extract_command =
g_strdup ("unzip -p -C");
list_files_command =
@@ -152,7 +145,7 @@
comics_document->regex_arg = TRUE;
}
- g_object_unref (file_info);
+ g_free (mime_type);
g_free (quoted_file);
/* Get list of files in archive */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]