lib/tori/backend/s3.rb in tori-0.6.0 vs lib/tori/backend/s3.rb in tori-0.6.1

- old
+ new

@@ -129,22 +129,22 @@ signer = Aws::S3::Presigner.new(client: client) signer.presigned_url(method, bucket: @bucket, key: filename) end def open(filename) - ext = ::File.extname(filename) - body = body(filename) + blob = read(filename) + opt = [::File.basename(filename), ::File.extname(filename)] if block_given? - Tempfile.create([filename, ext]) do |f| - f.write body + Tempfile.create(opt) do |f| + f.write blob f.fsync f.rewind yield f end else - f = Tempfile.open([filename, ext]) - f.write body + f = Tempfile.open(opt) + f.write blob f.fsync f.rewind f end end