Skip to content

Commit

Permalink
Don't forcefully close the uploaded file.
Browse files Browse the repository at this point in the history
  • Loading branch information
tpendragon committed Oct 15, 2021
1 parent 0b1a9ec commit 8a91c0b
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
2 changes: 1 addition & 1 deletion lib/valkyrie/specs/shared_specs/storage_adapter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ class Valkyrie::Specs::CustomResource < Valkyrie::Resource
resource = Valkyrie::Specs::CustomResource.new(id: "testdiscovery")
pre_open_files = open_files
uploaded_file = storage_adapter.upload(file: file, original_filename: 'foo.jpg', resource: resource, fake_upload_argument: true)
expect(pre_open_files.size).to eq open_files.size
file.close
expect(pre_open_files.size).to eq open_files.size

pre_open_files = open_files
the_file = storage_adapter.find_by(id: uploaded_file.id)
Expand Down
1 change: 0 additions & 1 deletion lib/valkyrie/storage/disk.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ def upload(file:, original_filename:, resource: nil, **_extra_arguments)
new_path = path_generator.generate(resource: resource, file: file, original_filename: original_filename)
FileUtils.mkdir_p(new_path.parent)
file_mover.call(file.path, new_path)
file.try(:close)
find_by(id: Valkyrie::ID.new("disk://#{new_path}"))
end

Expand Down

0 comments on commit 8a91c0b

Please sign in to comment.