Skip to content

Commit

Permalink
use uploaded_file for new versions
Browse files Browse the repository at this point in the history
  • Loading branch information
Julie Allinson authored and tamsin johnson committed Feb 19, 2021
1 parent 03106cf commit da0fd99
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion app/controllers/hyrax/file_sets_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,18 @@ def attempt_update
actor.revert_content(params[:revision])
elsif params.key?(:file_set)
if params[:file_set].key?(:files)
actor.update_content(params[:file_set][:files].first)
actor.update_content(uploaded_file_from_path)
else
update_metadata
end
end
end

def uploaded_file_from_path
uploaded_file = CarrierWave::SanitizedFile.new(params[:file_set][:files].first)
Hyrax::UploadedFile.create(user_id: current_user.id, file: uploaded_file)
end

def after_update_response
respond_to do |wants|
wants.html do
Expand Down

0 comments on commit da0fd99

Please sign in to comment.