[gnome-epub-thumbnailer/wip/hadess/epub-workaround: 6/6] epub: Work-around a broken ePub not getting a cover




commit efd4343f746a21e1a4c3a6d66f9351cf325c3538
Author: Bastien Nocera <hadess hadess net>
Date:   Wed Sep 28 17:39:02 2022 +0200

    epub: Work-around a broken ePub not getting a cover
    
    The content attribute of the meta tag is supposed to point to another
    item with that id, but we can easily support it pointing directly to an
    image path.

 gnome-epub-thumbnailer.c | 2 ++
 1 file changed, 2 insertions(+)
---
diff --git a/gnome-epub-thumbnailer.c b/gnome-epub-thumbnailer.c
index 41d9653..240da98 100644
--- a/gnome-epub-thumbnailer.c
+++ b/gnome-epub-thumbnailer.c
@@ -252,6 +252,8 @@ get_cover_path_from_root_file (const char *metafile,
 
                xpath = g_strdup_printf ("//ns:package/ns:manifest/ns:item[@id='%s']", content_name);
                cover_path = get_prop_for_xpath (doc, xpath_ctx, xpath, "href");
+               if (!cover_path)
+                       cover_path = g_strdup (content_name);
        }
 
        g_debug ("Found cover_path '%s'", cover_path);


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