Skip to content
This repository was archived by the owner on Aug 29, 2023. It is now read-only.

Commit 74b49e5

Browse files
authored
Merge pull request #61 from nitxy/bug-fix
Fix incorrect subsection title and duplicated mimetype
2 parents dcb6695 + d4d062e commit 74b49e5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

write.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ func (e *Epub) writeEpub(rootEpubDir string, dst io.Writer) (int64, error) {
255255
}
256256

257257
var w io.Writer
258-
if path == filepath.Join(rootEpubDir, mimetypeFilename) {
258+
if filepath.FromSlash(path) == filepath.Join(rootEpubDir, mimetypeFilename) {
259259
// Skip the mimetype file if it's already been written
260260
if skipMimetypeFile == true {
261261
return nil
@@ -441,7 +441,7 @@ func (e *Epub) writeSections(rootEpubDir string) {
441441
for _, child := range *section.children {
442442
index += 1
443443
relativeSubPath := filepath.Join(xhtmlFolderName, child.filename)
444-
e.toc.addSubSection(relativePath, index, section.xhtml.Title(), relativeSubPath)
444+
e.toc.addSubSection(relativePath, index, child.xhtml.Title(), relativeSubPath)
445445

446446
subSectionFilePath := filepath.Join(rootEpubDir, contentFolderName, xhtmlFolderName, child.filename)
447447
child.xhtml.write(subSectionFilePath)

0 commit comments

Comments
 (0)