Commit 752fba3
fix(reading): read an EPUB that macOS re-zipped as the book it is
Finder's "Compress" does two things to an EPUB: it nests the whole book
under one folder, and it writes a parallel `__MACOSX/` tree of AppleDouble
resource forks that carry the content files' names and extensions.
The package lookup only ever looked for `META-INF/container.xml` at the
archive root, so a wrapped book found no container, no OPF and no spine,
and fell back to matching file extensions over the whole archive. That
fallback then read `__MACOSX/OEBPS/._index_split_000.xhtml` — 60 bytes of
binary resource fork — as a chapter. Hence the phantom `._…` sections in
the sidebar and "Could not load this section" on opening them (#1447).
Both halves of the same rule, in one place. Packaging residue (`__MACOSX`,
dotfiles) is not book content and never reaches either reader; the other
archive readers in this codebase already drop it. And a single wrapper
directory is resolved from wherever the container actually sits, so spine
order survives it.
The container/OPF chain was written out twice — once for the spine, once
for the navigation — so a wrapped book silently lost its whole outline
too, by a `return []` in the half nobody was looking at. One resolver now
answers "where is this book's package document" for both.
Co-Authored-By: Claude Opus 5 <[email protected]>1 parent 883c90f commit 752fba3
2 files changed
Lines changed: 100 additions & 31 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
| 99 | + | |
| 100 | + | |
99 | 101 | | |
100 | 102 | | |
101 | 103 | | |
| |||
642 | 644 | | |
643 | 645 | | |
644 | 646 | | |
645 | | - | |
646 | | - | |
| 647 | + | |
| 648 | + | |
647 | 649 | | |
648 | | - | |
649 | | - | |
650 | | - | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
651 | 654 | | |
652 | | - | |
653 | | - | |
| 655 | + | |
654 | 656 | | |
655 | | - | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
656 | 679 | | |
657 | | - | |
| 680 | + | |
658 | 681 | | |
659 | | - | |
| 682 | + | |
660 | 683 | | |
661 | 684 | | |
662 | | - | |
| 685 | + | |
663 | 686 | | |
664 | | - | |
665 | | - | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
666 | 692 | | |
667 | | - | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
668 | 702 | | |
669 | 703 | | |
670 | 704 | | |
| |||
706 | 740 | | |
707 | 741 | | |
708 | 742 | | |
709 | | - | |
710 | | - | |
711 | | - | |
712 | | - | |
713 | | - | |
714 | | - | |
715 | | - | |
716 | | - | |
717 | | - | |
718 | | - | |
719 | | - | |
720 | | - | |
721 | | - | |
722 | | - | |
| 743 | + | |
723 | 744 | | |
724 | 745 | | |
725 | 746 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
| |||
82 | 83 | | |
83 | 84 | | |
84 | 85 | | |
| 86 | + | |
| 87 | + | |
85 | 88 | | |
86 | 89 | | |
87 | 90 | | |
88 | 91 | | |
89 | 92 | | |
90 | 93 | | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
91 | 98 | | |
92 | 99 | | |
93 | 100 | | |
| |||
102 | 109 | | |
103 | 110 | | |
104 | 111 | | |
| 112 | + | |
105 | 113 | | |
106 | 114 | | |
107 | 115 | | |
108 | 116 | | |
109 | | - | |
| 117 | + | |
110 | 118 | | |
111 | | - | |
| 119 | + | |
112 | 120 | | |
113 | 121 | | |
114 | | - | |
| 122 | + | |
115 | 123 | | |
116 | 124 | | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
117 | 129 | | |
118 | 130 | | |
119 | 131 | | |
| |||
281 | 293 | | |
282 | 294 | | |
283 | 295 | | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
284 | 332 | | |
285 | 333 | | |
286 | 334 | | |
| |||
0 commit comments