[gnome-epub-thumbnailer] epub: Fix cover path for root=level OPF files



commit 6b8964ee5716ce6abe86d656886f3b389fa4c0cb
Author: Chris Lee <clee mg8 org>
Date:   Fri Apr 4 05:26:20 2014 -0700

    epub: Fix cover path for root=level OPF files
    
    If the OPF file is in the root dir, g_path_get_dirname returns "."
    instead of an empty string. This results in an invalid key for the cover
    image, because it looks like "./OEBPS/cover_path.jpg" instead of
    "OEBPS/cover_path.jpg" and then unzipping for that path fails.

 gnome-epub-thumbnailer.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/gnome-epub-thumbnailer.c b/gnome-epub-thumbnailer.c
index b3e45e3..07aacc3 100644
--- a/gnome-epub-thumbnailer.c
+++ b/gnome-epub-thumbnailer.c
@@ -196,7 +196,10 @@ resolve_cover_path (const char *cover_path,
        char *ret;
 
        dirname = g_path_get_dirname (root_path);
-       ret = g_build_filename (dirname, cover_path, NULL);
+       if (g_strcmp0(".", dirname) != 0)
+               ret = g_build_filename (dirname, cover_path, NULL);
+       else
+               ret = g_strdup(cover_path);
        g_free (dirname);
 
        return ret;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]