6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# File 'app/controllers/active_storage/async_variants/callbacks_controller.rb', line 6
def create
variant_record_id = ActiveStorage.verifier.verify(params[:token], purpose: :async_variant_callback)
variant_record = ActiveStorage::VariantRecord.find(variant_record_id)
case params[:status]
when "success"
variant_record.update!(state: "processed")
apply_reported_metadata(variant_record, params)
when "failed"
variant_record.update!(state: "failed", error: params[:error].to_s.truncate(16_000))
else
head :unprocessable_entity and return
end
head :ok
rescue ActiveSupport::MessageVerifier::InvalidSignature
head :unauthorized
end
|