Class: S3DirectMultipartUpload::UploadPartsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/s3_direct_multipart_upload/upload_parts_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



6
7
8
9
10
11
12
13
14
15
16
# File 'app/controllers/s3_direct_multipart_upload/upload_parts_controller.rb', line 6

def create
  @upload_session.report_part!(
    part_number: part_params.fetch(:part_number).to_i,
    etag: part_params.fetch(:etag)
  )
  head :accepted
rescue ActiveRecord::RecordNotFound
  render json: { error: "not found" }, status: :not_found
rescue ArgumentError, ActiveRecord::RecordInvalid => e
  render json: { error: e.message }, status: :unprocessable_content
end