Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Viewer fails for older files #844

Merged
merged 1 commit into from
Oct 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,20 @@ module CanvasBuilderFactoryDecorator
def from(work)
composite_builder.new(
*file_set_presenters(work).map do |presenter|
next if presenter.solr_document['original_filename_ssi'].downcase.end_with?(HykuKnapsack::Engine::THUMBNAIL_FILE_SUFFIX) || !presenter.image?
next if thumbnail?(presenter) || !presenter.image?
canvas_builder_factory.new(presenter, work)
end
)
end

private

# older filesets may not have original_filename_ssi indexed so fallback to label_ssi
def thumbnail?(presenter)
filename = presenter.solr_document['original_filename_ssi'] || presenter.solr_document['label_ssi']
return false unless filename
filename.end_with?(HykuKnapsack::Engine::THUMBNAIL_FILE_SUFFIX)
end
end
end
end
Expand Down
Loading