Skip to content

Commit

Permalink
Update distributions.rake
Browse files Browse the repository at this point in the history
  • Loading branch information
ewlarson committed Dec 16, 2024
1 parent 4cd4c31 commit 02c7ab5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/geoblacklight_admin/tasks/distributions.rake
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,12 @@ namespace :geoblacklight_admin do
end
rescue TypeError => e
puts "TypeError processing distribution: #{distribution[0]} - #{e.inspect}"
puts "Distribution: #{distribution.inspect}"

# Fix for #<TypeError: can't cast Hash>
# These are download links that are not already in an array
# ex. "{\"http://schema.org/url\":\"https://datacore.iu.edu/concern/data_sets/hx11xf65s\",\"http://schema.org/downloadUrl\":{\"label\":\"PDF\",\"url\":\"https://datacore.iu.edu/downloads/ms35t9074\"}}"
if distribution[2].is_a?(Hash)
if distribution[2] && distribution[2].is_a?(Hash)
DocumentDistribution.find_or_create_by!(
friendlier_id: distribution[0],
reference_type_id: ReferenceType.find_by(name: distribution[1]).id,
Expand Down

0 comments on commit 02c7ab5

Please sign in to comment.