diff --git a/0001-Update-skeleton-to-fix-crash-with-trash-recent-files.patch b/0001-Update-skeleton-to-fix-crash-with-trash-recent-files.patch new file mode 100644 index 0000000..20da236 --- /dev/null +++ b/0001-Update-skeleton-to-fix-crash-with-trash-recent-files.patch @@ -0,0 +1,73 @@ +From 53d83c1a4a7f140149fec7f2aecf91034dbb3546 Mon Sep 17 00:00:00 2001 +From: Bastien Nocera +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 + diff --git a/0001-mobi-Don-t-bail-on-encrypted-mobi-files.patch b/0001-mobi-Don-t-bail-on-encrypted-mobi-files.patch new file mode 100644 index 0000000..709a161 --- /dev/null +++ b/0001-mobi-Don-t-bail-on-encrypted-mobi-files.patch @@ -0,0 +1,33 @@ +From 675c4efafbfc1ecc9982ffcdb917fd4f73ca6a71 Mon Sep 17 00:00:00 2001 +From: Chris Lee +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 + diff --git a/gnome-epub-thumbnailer.spec b/gnome-epub-thumbnailer.spec index 20e66e8..e52cf31 100644 --- a/gnome-epub-thumbnailer.spec +++ b/gnome-epub-thumbnailer.spec @@ -1,6 +1,6 @@ Name: gnome-epub-thumbnailer Version: 1.3 -Release: 2%{?dist} +Release: 3%{?dist} Summary: Thumbnailers for EPub and MOBI books License: GPLv2+ @@ -9,6 +9,10 @@ Source0: http://download.gnome.org/sources/%{name}/1.3/%{name}-%{version} # Upstream commit 68841e9a7658b6bafd4d94f4199ea047d303f1d3 Patch1: 0001-epub-Set-an-error-when-the-cover-can-t-be-found.patch +# Upstream 675c4efafbfc1ecc9982ffcdb917fd4f73ca6a71 +Patch2: 0001-mobi-Don-t-bail-on-encrypted-mobi-files.patch +# Upstream commit 53d83c1a4a7f140149fec7f2aecf91034dbb3546 +Patch3: 0001-Update-skeleton-to-fix-crash-with-trash-recent-files.patch BuildRequires: pkgconfig(gdk-pixbuf-2.0) BuildRequires: pkgconfig(gio-2.0) @@ -21,7 +25,7 @@ Thumbnailers for EPub and MOBI books %prep %setup -q -%patch1 -p1 -b .crash-cover +%autopatch %build @@ -44,6 +48,10 @@ make DESTDIR=$RPM_BUILD_ROOT install %changelog +* Sun Oct 27 2013 Yanko Kaneti - 1.3-3 +- Fix crashes on thumbnailing trash/recent files - #1046245 +- Get unencrypted cover from otherwise encrypted mobi files + * Sun Oct 27 2013 Yanko Kaneti - 1.3-2 - Don't crash on failure to find a cover file - #1001559