Commit 06e5ad8
Decouple load_rels from load_styles (#158)
Previously load_rels was called from inside load_styles, so when a document
had no word/styles.xml, load_styles raised Errno::ENOENT, was rescued, and
load_rels never ran -- leaving @RELS nil. Any later call to #hyperlinks then
crashed with "undefined method 'xpath' for nil".
load_rels is now called independently from initialize and handles a missing
rels file gracefully, so relationships load regardless of whether styles.xml
is present.
Adds a regression fixture (no_styles_with_hyperlink.docx: a document with a
hyperlink relationship but no styles.xml) and a spec asserting #hyperlinks
works in that case.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>1 parent 7297e19 commit 06e5ad8
3 files changed
Lines changed: 20 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| 43 | + | |
43 | 44 | | |
44 | 45 | | |
45 | 46 | | |
| |||
226 | 227 | | |
227 | 228 | | |
228 | 229 | | |
229 | | - | |
230 | 230 | | |
231 | 231 | | |
232 | 232 | | |
233 | 233 | | |
234 | 234 | | |
| 235 | + | |
| 236 | + | |
235 | 237 | | |
236 | 238 | | |
237 | 239 | | |
238 | 240 | | |
239 | 241 | | |
240 | 242 | | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
241 | 246 | | |
242 | 247 | | |
243 | 248 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
612 | 612 | | |
613 | 613 | | |
614 | 614 | | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
615 | 629 | | |
616 | 630 | | |
617 | 631 | | |
| |||
Binary file not shown.
0 commit comments