From 06a38dfe15375ce19d3dabff2713031987691d92 Mon Sep 17 00:00:00 2001 From: Rob Kaufman Date: Fri, 20 Sep 2024 13:41:48 -0700 Subject: [PATCH] more fixes for old collection thumbnail path support --- .../hyrax/thumbnail_path_service_decorator.rb | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/app/services/hyrax/thumbnail_path_service_decorator.rb b/app/services/hyrax/thumbnail_path_service_decorator.rb index f436a8097..876c87a7c 100644 --- a/app/services/hyrax/thumbnail_path_service_decorator.rb +++ b/app/services/hyrax/thumbnail_path_service_decorator.rb @@ -10,7 +10,18 @@ def call(object) collection_thumbnail = CollectionBrandingInfo.where(collection_id: object.id.to_s, role: "thumbnail").first return collection_thumbnail.local_path.gsub(Hyrax.config.branding_path.to_s, '/branding') if collection_thumbnail - default_collection_image + return default_image if object.try(:thumbnail_id).blank? + + thumb = fetch_thumbnail(object) + return default_collection_image unless thumb + return call(thumb) unless thumb.file_set? + if audio?(thumb) + audio_image + elsif thumbnail?(thumb) + thumbnail_path(thumb) + else + default_collection_image + end end def default_collection_image