Skip to content

Commit

Permalink
Close file after uploading
Browse files Browse the repository at this point in the history
  • Loading branch information
zinkkrysty committed Jul 6, 2017
1 parent a4aaf59 commit c7ec7a9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/asset_sync/storage.rb
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,10 @@ def upload_file(f)
one_year = 31557600
ext = File.extname(f)[1..-1]
mime = MultiMime.lookup(ext)
file_handle = File.open("#{path}/#{f}")
file = {
:key => f,
:body => File.open("#{path}/#{f}"),
:body => file_handle,
:public => true,
:content_type => mime
}
Expand Down Expand Up @@ -199,7 +200,8 @@ def upload_file(f)
})
end

file = bucket.files.create( file ) unless ignore
bucket.files.create( file ) unless ignore
file_handle.close
end

def upload_files
Expand Down

0 comments on commit c7ec7a9

Please sign in to comment.