fix: Handle EPUB 3 TOC to spine mapping when nav file in subdirectory

Fixes https://github.com/daveallie/crosspoint-reader/issues/264
This commit is contained in:
Dave Allie
2026-01-13 00:52:00 +11:00
parent 0165fab581
commit 93a68b9ffa
4 changed files with 10 additions and 5 deletions

View File

@@ -167,7 +167,10 @@ bool Epub::parseTocNavFile() const {
}
const auto navSize = tempNavFile.size();
TocNavParser navParser(contentBasePath, navSize, bookMetadataCache.get());
// Note: We can't use `contentBasePath` here as the nav file may be in a different folder to the content.opf
// and the HTMLX nav file will have hrefs relative to itself
const std::string navContentBasePath = tocNavItem.substr(0, tocNavItem.find_last_of('/') + 1);
TocNavParser navParser(navContentBasePath, navSize, bookMetadataCache.get());
if (!navParser.setup()) {
Serial.printf("[%lu] [EBP] Could not setup toc nav parser\n", millis());