Skip to content

Commit

Permalink
Merge pull request #2012 from samvera/favor-hyku-application-path-for
Browse files Browse the repository at this point in the history
♻️ Favor Hyku::Application.path_for over Rails.root
  • Loading branch information
jeremyf authored Oct 5, 2023
2 parents de00833 + ff3fbcc commit bd4ca7b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions app/services/uploaded_collection_thumbnail_path_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ def call(object)

# rubocop:disable Metrics/LineLength, Rails/FilePath, Lint/StringConversionInInterpolation
def uploaded_thumbnail?(collection)
File.exist?("#{Rails.root.to_s}/public/uploads/uploaded_collection_thumbnails/#{collection.id}/#{collection.id}_card.jpg")
File.exist?(File.join(upload_dir(collection), "#{collection.id}_card.jpg"))
end

def upload_dir(collection)
"#{Rails.root.to_s}/public/uploads/uploaded_collection_thumbnails/#{collection.id}"
Hyku::Application.path_for("public/uploads/uploaded_collection_thumbnails/#{collection.id}")
end
# rubocop:enable Metrics/LineLength, Rails/FilePath, Lint/StringConversionInInterpolation
end
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<% thumbnail_path = SolrDocument.find(@collection.id).thumbnail_path %>
<% if thumbnail_path.include?("uploaded_collection_thumbnails") and File.exist? Rails.root.join("public#{::SolrDocument.find(@collection.id).thumbnail_path}") %>
<% if thumbnail_path.include?("uploaded_collection_thumbnails") and File.exist? Hyky::Application.path_for("public#{::SolrDocument.find(@collection.id).thumbnail_path}") %>
<%= image_tag(thumbnail_path, class: "current-thumbnail") %>
<p>Current image: <strong><%= @thumbnail_filename %></strong></p>
<% else %>
Expand Down

0 comments on commit bd4ca7b

Please sign in to comment.