Skip to content

Commit

Permalink
fix regression preventing navdoc parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
chocolatkey committed Jan 11, 2025
1 parent b997dc7 commit d935e76
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions pkg/parser/epub/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,14 +111,13 @@ func parseNavigationData(packageDocument PackageDocument, fetcher fetcher.Fetche
if ncxItem == nil {
return
}
ncxPath := packageDocument.Path.Resolve(ncxItem.Href)
n, nerr := fetcher.Get(manifest.Link{Href: manifest.NewHREF(ncxPath)}).ReadAsXML(map[string]string{
n, nerr := fetcher.Get(manifest.Link{Href: manifest.NewHREF(ncxItem.Href)}).ReadAsXML(map[string]string{
NamespaceNCX: "ncx",
})
if nerr != nil {
return
}
ret = ParseNCX(n, ncxPath)
ret = ParseNCX(n, ncxItem.Href)
} else {
var navItem *Item
for _, v := range packageDocument.Manifest {
Expand All @@ -135,15 +134,14 @@ func parseNavigationData(packageDocument PackageDocument, fetcher fetcher.Fetche
if navItem == nil {
return
}
navPath := packageDocument.Path.Resolve(navItem.Href)
n, errx := fetcher.Get(manifest.Link{Href: manifest.NewHREF(navPath)}).ReadAsXML(map[string]string{
n, errx := fetcher.Get(manifest.Link{Href: manifest.NewHREF(navItem.Href)}).ReadAsXML(map[string]string{
NamespaceXHTML: "html",
NamespaceOPS: "epub",
})
if errx != nil {
return
}
ret = ParseNavDoc(n, navPath)
ret = ParseNavDoc(n, navItem.Href)
}
return
}
Expand Down

0 comments on commit d935e76

Please sign in to comment.