Skip to content

Commit

Permalink
Merge pull request #3721 from mlibrary/HELIO-4768/origami_reference_e…
Browse files Browse the repository at this point in the history
…rror

HELIO-4768 - Origami::Reference error on interval title
  • Loading branch information
sethaj authored Nov 20, 2024
2 parents bf5458b + b626bec commit 26eb6b7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/pdf_ebook/publication.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ def iterate_outlines(outline, depth) # rubocop:disable Metrics/CyclomaticComplex
page ||= outline[:Dest]&.solve&.[](0)&.solve
unless page.nil?
page_number = @obj_to_page[page.no] || 0
intervals << PDFEbook::Interval.from_title_level_cfi(id, index, outline[:Title].to_utf8, depth, "page=#{page_number}")
# HELIO-4768: very rarely `title` is an `Origami::Reference` at this point, for whatever reason
title = outline[:Title].is_a?(Origami::Reference) ? outline[:Title]&.solve : outline[:Title]
intervals << PDFEbook::Interval.from_title_level_cfi(id, index, title.to_utf8, depth, "page=#{page_number}")
index += 1
end
unless outline[:First]&.solve.nil? # Child outline
Expand Down

0 comments on commit 26eb6b7

Please sign in to comment.