summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Webster <[email protected]>2022-07-18 10:43:47 -0400
committerLuke from DC <[email protected]>2022-08-04 19:49:30 +0000
commit886866b1437119ae9a21b4957d327071cf453308 (patch)
tree9419a47605a59eb1c69460e23bc90efabd804a47
parentacb33ad155ef1a98c2d240900cd11727d9dab465 (diff)
downloadatril-master.tar.bz2
atril-master.tar.xz
epub: Fix index loading for certain documents - look for epub:typeHEADmaster
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
-rw-r--r--backend/epub/epub-document.c8
1 files changed, 7 insertions, 1 deletions
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,"/");