app/actors/hyrax/actors/create_with_remote_files_actor.rb
# Generic utility for creating FileSet from a URL
# Used in to import files using URLs from a file picker like browse_everything
Generic utility for creating FileSet from a URL
Used in to import files using URLs from a file picker like browse_everything
Generic utility for creating FileSet from a URL Used in to import files using URLs from a file picker like browse_everything
def create_file_from_url(env, uri, file_name, _auth_header = {})
          ::FileSet.new(import_url: uri.to_s, label: file_name) do |fs|
            actor = Hyrax::Actors::FileSetActor.new(fs, env.user)
            actor.create_metadata(visibility: env.curation_concern.visibility)
            actor.attach_to_work(env.curation_concern)
            apply_saved_metadata(fs, env.curation_concern)
            fs.save!
            if uri.scheme == 'file'
              file_path = CGI.unescape(uri.path)
              IngestLocalFileJob.perform_later(fs, file_path, env.user)
            else
              ImportUrlJob.perform_later(fs, operation_for(user: actor.user))
            end
          end
        end
def create_file_from_url ( env , uri , file_name , _auth_header = { } ) :: FileSet . new ( import_url : uri . to_s , label : file_name ) do | fs | actor = Hyrax :: Actors :: FileSetActor . new ( fs , env . user ) actor . create_metadata ( visibility : env . curation_concern . visibility ) actor . attach_to_work ( env . curation_concern ) apply_saved_metadata ( fs , env . curation_concern ) fs . save! if uri . scheme == 'file' file_path = CGI . unescape ( uri . path ) IngestLocalFileJob . perform_later ( fs , file_path , env . user ) else ImportUrlJob . perform_later ( fs , operation_for ( user : actor . user ) ) end end end
Generic utility for creating FileSet from a URL
Used in to import files using URLs from a file picker like browse_everything
Generic utility for creating FileSet from a URL Used in to import files using URLs from a file picker like browse_everything
# Turn any %20 into spaces.
env
<not_specific>
uri
<not_specific>
file_name
<not_specific>
_auth_header
<not_specific>