From 886866b1437119ae9a21b4957d327071cf453308 Mon Sep 17 00:00:00 2001 From: Michael Webster Date: Mon, 18 Jul 2022 10:43:47 -0400 Subject: epub: Fix index loading for certain documents - look for epub:type instead of epub:id. Add a null check as well. ref: https://help.apple.com/itc/booksassetguide/en.lproj/itc0f175a5b9.html#apdd3c4c6d1c0904 https://idpf.org/epub/301/spec/epub-contentdocs-20140626.html#sec-xhtml-nav --- backend/epub/epub-document.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'backend/epub') diff --git a/backend/epub/epub-document.c b/backend/epub/epub-document.c index c22d3e47..9840ca3c 100644 --- a/backend/epub/epub-document.c +++ b/backend/epub/epub-document.c @@ -1199,7 +1199,13 @@ setup_index_from_navfile(gchar *tocpath) GList *index = NULL; open_xml_document(tocpath); set_xml_root_node(NULL); - xmlNodePtr nav = xml_get_pointer_to_node((xmlChar*)"nav",(xmlChar*)"id",(xmlChar*)"toc"); + xmlNodePtr nav = xml_get_pointer_to_node((xmlChar*)"nav",(xmlChar*)"type",(xmlChar*)"toc"); + + if (nav == NULL) { + xml_free_doc(); + return NULL; + } + xmlretval=NULL; xml_parse_children_of_node(nav,(xmlChar*)"ol", NULL,NULL); gchar *navdirend = g_strrstr(tocpath,"/"); -- cgit v1.2.1