diff options
author | Michael Webster <[email protected]> | 2022-07-18 10:43:47 -0400 |
---|---|---|
committer | raveit65 <[email protected]> | 2023-04-28 21:13:42 +0200 |
commit | 9f5d7343f79f6ff8295884df3229bc6696b4386c (patch) | |
tree | 1142fb1c741c07948f593ca160736454406df330 | |
parent | 04f6865acc23cfa22219710d3cc1245e0253bd2f (diff) | |
download | atril-9f5d7343f79f6ff8295884df3229bc6696b4386c.tar.bz2 atril-9f5d7343f79f6ff8295884df3229bc6696b4386c.tar.xz |
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
-rw-r--r-- | backend/epub/epub-document.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/backend/epub/epub-document.c b/backend/epub/epub-document.c index 52530f47..385d2fea 100644 --- a/backend/epub/epub-document.c +++ b/backend/epub/epub-document.c @@ -1201,7 +1201,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,"/"); |