Class: S3DirectMultipartUpload::Dev::StorageDownloadsController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/s3_direct_multipart_upload/dev/storage_downloads_controller.rb

Instance Method Summary collapse

Instance Method Details

#showObject



9
10
11
12
13
14
15
16
17
18
# File 'app/controllers/s3_direct_multipart_upload/dev/storage_downloads_controller.rb', line 9

def show
  return render json: { error: "upload is not completed" }, status: :unprocessable_content unless @upload_session.completed?

  ensure_combined_file!
  return render json: { error: "combined file is missing" }, status: :unprocessable_content unless dev_storage_path.exist?

  send_file dev_storage_path, filename: @upload_session.filename, disposition: :inline, type: "application/octet-stream"
rescue RuntimeError => e
  render json: { error: e.message }, status: :unprocessable_content
end