Skip to content

Commit

Permalink
🐛 Correct thumbnail_path_ss value
Browse files Browse the repository at this point in the history
  • Loading branch information
ShanaLMoore committed May 31, 2024
1 parent cc180ba commit fb94bd5
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/forms/hyrax/forms/pcdm_collection_form_decorator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
if thumbnail_info
thumbnail_file = File.split(thumbnail_info.local_path).last
alttext = thumbnail_info.alt_text
file_location = thumbnail_info.local_path
file_location = thumbnail_info.local_path.gsub('/app/samvera', '')
relative_path = "/" + thumbnail_info.local_path.split("/")[-4..-1].join("/")
{ file: thumbnail_file, full_path: file_location, relative_path:, alttext: }
else
Expand Down
1 change: 1 addition & 0 deletions app/indexers/collection_resource_indexer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ class CollectionResourceIndexer < Hyrax::Indexers::PcdmCollectionIndexer
include Hyrax::Indexer(:basic_metadata)
include Hyrax::Indexer(:bulkrax_metadata)
include Hyrax::Indexer(:collection_resource)
include Hyrax::IndexesThumbnails

def to_solr
super.tap do |index_document|
Expand Down
3 changes: 2 additions & 1 deletion app/services/hyrax/indexes_thumbnails_decorator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ module Hyrax
module IndexesThumbnailsDecorator
# Returns the value for the thumbnail path to put into the solr document
def thumbnail_path
object ||= @object || resource
if object.try(:collection?) && UploadedCollectionThumbnailPathService.uploaded_thumbnail?(object)
UploadedCollectionThumbnailPathService.call(object)
else
super
CollectionResourceIndexer.thumbnail_path_service.call(object).gsub('/app/samvera', '')
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace :hyku do
Collection.find_each do |collection|
# get collection solr document's thumbnail_path for each collection
doc = collection.to_solr
original_thumbnail_path = File.join(Rails.public_path, doc['thumbnail_path_ss'])
original_thumbnail_path = File.join('public/branding/', doc['thumbnail_path_ss'])

next unless File.exist?(original_thumbnail_path)

Expand Down

0 comments on commit fb94bd5

Please sign in to comment.