Skip to content

Commit

Permalink
Merge pull request #3718 from samvera/issue-1684
Browse files Browse the repository at this point in the history
when downloading from Box, use label for filename
  • Loading branch information
no-reply committed Apr 18, 2019
2 parents 4ae385b + b7fbcd7 commit f5c25cf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/jobs/import_url_job.rb
Expand Up @@ -62,7 +62,7 @@ def can_retrieve?(uri)
# @param uri [URI] the uri of the file to download
# @yield [IO] the stream to write to
def copy_remote_file(uri, headers = {})
filename = File.basename(uri.path)
filename = file_set.label
dir = Dir.mktmpdir
Rails.logger.debug("ImportUrlJob: Copying <#{uri}> to #{dir}")

Expand Down
5 changes: 3 additions & 2 deletions spec/jobs/import_url_job_spec.rb
Expand Up @@ -3,10 +3,11 @@

let(:file_path) { fixture_path + '/world.png' }
let(:file_hash) { '/673467823498723948237462429793840923582' }
let(:file_name) { 'world.png' }

let(:file_set) do
FileSet.new(import_url: "http://example.org#{file_hash}",
label: file_path) do |f|
label: file_name) do |f|
f.apply_depositor_metadata(user.user_key)
end
end
Expand Down Expand Up @@ -74,7 +75,7 @@

it 'leaves the temp directory in place' do
described_class.perform_now(file_set, operation)
expect(File.exist?(File.join(tmpdir, file_hash))).to be true
expect(File.exist?(File.join(tmpdir, file_name))).to be true
end
end

Expand Down

0 comments on commit f5c25cf

Please sign in to comment.