parent
477bcad3a8
commit
64e0783902
@ -1,73 +0,0 @@
|
||||
From 53d83c1a4a7f140149fec7f2aecf91034dbb3546 Mon Sep 17 00:00:00 2001
|
||||
From: Bastien Nocera <hadess@hadess.net>
|
||||
Date: Mon, 6 Jan 2014 12:45:24 +0100
|
||||
Subject: [PATCH] Update skeleton to fix crash with trash/recent files
|
||||
|
||||
---
|
||||
gnome-thumbnailer-skeleton.c | 41 ++++++++++++++++++++++++++++++++++++++++-
|
||||
1 file changed, 40 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/gnome-thumbnailer-skeleton.c b/gnome-thumbnailer-skeleton.c
|
||||
index b7ec3ec..e4c11a6 100644
|
||||
--- a/gnome-thumbnailer-skeleton.c
|
||||
+++ b/gnome-thumbnailer-skeleton.c
|
||||
@@ -34,6 +34,40 @@ static int output_size = 256;
|
||||
static gboolean g_fatal_warnings = FALSE;
|
||||
static char **filenames = NULL;
|
||||
|
||||
+static char *
|
||||
+get_target_uri (GFile *file)
|
||||
+{
|
||||
+ GFileInfo *info;
|
||||
+ char *target;
|
||||
+
|
||||
+ info = g_file_query_info (file, G_FILE_ATTRIBUTE_STANDARD_TARGET_URI, G_FILE_QUERY_INFO_NONE, NULL, NULL);
|
||||
+ if (info == NULL)
|
||||
+ return NULL;
|
||||
+ target = g_strdup (g_file_info_get_attribute_string (info, G_FILE_ATTRIBUTE_STANDARD_TARGET_URI));
|
||||
+ g_object_unref (info);
|
||||
+
|
||||
+ return target;
|
||||
+}
|
||||
+
|
||||
+static char *
|
||||
+get_target_path (GFile *input)
|
||||
+{
|
||||
+ if (g_file_has_uri_scheme (input, "trash") != FALSE ||
|
||||
+ g_file_has_uri_scheme (input, "recent") != FALSE) {
|
||||
+ GFile *file;
|
||||
+ char *input_uri;
|
||||
+ char *input_path;
|
||||
+
|
||||
+ input_uri = get_target_uri (input);
|
||||
+ file = g_file_new_for_uri (input_uri);
|
||||
+ g_free (input_uri);
|
||||
+ input_path = g_file_get_path (file);
|
||||
+ g_object_unref (file);
|
||||
+ return input_path;
|
||||
+ }
|
||||
+ return g_file_get_path (input);
|
||||
+}
|
||||
+
|
||||
static const GOptionEntry entries[] = {
|
||||
{ "size", 's', 0, G_OPTION_ARG_INT, &output_size, "Size of the thumbnail in pixels", NULL },
|
||||
{"g-fatal-warnings", 0, 0, G_OPTION_ARG_NONE, &g_fatal_warnings, "Make all warnings fatal", NULL},
|
||||
@@ -84,9 +118,14 @@ int main (int argc, char **argv)
|
||||
}
|
||||
|
||||
input = g_file_new_for_commandline_arg (filenames[0]);
|
||||
- input_filename = g_file_get_path (input);
|
||||
+ input_filename = get_target_path (input);
|
||||
g_object_unref (input);
|
||||
|
||||
+ if (input_filename == NULL) {
|
||||
+ g_warning ("Could not get file path for %s", filenames[0]);
|
||||
+ return 1;
|
||||
+ }
|
||||
+
|
||||
output = filenames[1];
|
||||
|
||||
#ifdef THUMBNAILER_RETURNS_PIXBUF
|
||||
--
|
||||
1.8.5.2
|
||||
|
@ -1,27 +0,0 @@
|
||||
From 68841e9a7658b6bafd4d94f4199ea047d303f1d3 Mon Sep 17 00:00:00 2001
|
||||
From: Bastien Nocera <hadess@hadess.net>
|
||||
Date: Sun, 1 Sep 2013 17:26:13 +0200
|
||||
Subject: [PATCH] epub: Set an error when the cover can't be found
|
||||
|
||||
This stops a crash in the thumbnailer if the cover cannot
|
||||
be found.
|
||||
---
|
||||
gnome-epub-thumbnailer.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/gnome-epub-thumbnailer.c b/gnome-epub-thumbnailer.c
|
||||
index e2a3615..1cb8149 100644
|
||||
--- a/gnome-epub-thumbnailer.c
|
||||
+++ b/gnome-epub-thumbnailer.c
|
||||
@@ -283,7 +283,7 @@ file_to_data (const char *path,
|
||||
}
|
||||
|
||||
if (cover_data == NULL) {
|
||||
- g_warning ("Could not find cover file in '%s'", path);
|
||||
+ g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED, "Could not find cover file");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
--
|
||||
1.8.3.1
|
||||
|
@ -1,33 +0,0 @@
|
||||
From 675c4efafbfc1ecc9982ffcdb917fd4f73ca6a71 Mon Sep 17 00:00:00 2001
|
||||
From: Chris Lee <clee@mg8.org>
|
||||
Date: Wed, 13 Nov 2013 01:58:30 -0800
|
||||
Subject: [PATCH] mobi: Don't bail on encrypted mobi files
|
||||
|
||||
The image data isn't encrypted, so we can still generate thumbnails.
|
||||
|
||||
http://wiki.mobileread.com/wiki/MOBI#MOBI_DRM
|
||||
---
|
||||
gnome-mobi-thumbnailer.c | 7 -------
|
||||
1 file changed, 7 deletions(-)
|
||||
|
||||
diff --git a/gnome-mobi-thumbnailer.c b/gnome-mobi-thumbnailer.c
|
||||
index f7c4081..67c04bf 100644
|
||||
--- a/gnome-mobi-thumbnailer.c
|
||||
+++ b/gnome-mobi-thumbnailer.c
|
||||
@@ -166,13 +166,6 @@ get_image_section (GInputStream *stream,
|
||||
|
||||
header = get_section_data (G_INPUT_STREAM (stream), sections, 0, &len);
|
||||
|
||||
- /* Checking crypto type */
|
||||
- if (get_guint16 (header + 0xC) != 0) {
|
||||
- g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED, "File is encrypted");
|
||||
- g_free (header);
|
||||
- return -1;
|
||||
- }
|
||||
-
|
||||
/* Checking metadata availability */
|
||||
if (!(get_guint32 (header + 0x80) & 0x40)) {
|
||||
g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED, "File has no metadata");
|
||||
--
|
||||
1.8.5.2
|
||||
|
@ -1,27 +0,0 @@
|
||||
From 3358deaeb0a2025d0bfa8458e697f0e911e2f363 Mon Sep 17 00:00:00 2001
|
||||
From: Bastien Nocera <hadess@hadess.net>
|
||||
Date: Wed, 13 Nov 2013 18:21:19 +0100
|
||||
Subject: [PATCH] mobi: Fix parsing garbage with no cover
|
||||
|
||||
We were never checking the retval of get_cover_img_num() so if
|
||||
no covers were found, we'd try to read index-of-first-img minus 1.
|
||||
---
|
||||
gnome-mobi-thumbnailer.c | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/gnome-mobi-thumbnailer.c b/gnome-mobi-thumbnailer.c
|
||||
index 67c04bf..797192a 100644
|
||||
--- a/gnome-mobi-thumbnailer.c
|
||||
+++ b/gnome-mobi-thumbnailer.c
|
||||
@@ -183,6 +183,8 @@ get_image_section (GInputStream *stream,
|
||||
}
|
||||
|
||||
image_num = get_cover_img_num (header);
|
||||
+ if (image_num < 0)
|
||||
+ return image_num;
|
||||
|
||||
return first_img + image_num;
|
||||
}
|
||||
--
|
||||
1.8.5.2
|
||||
|
Loading…
Reference in new issue