diff options
author | Starfall <root@starfall.blue> | 2020-04-11 20:04:56 -0500 |
---|---|---|
committer | Starfall <root@starfall.blue> | 2020-04-11 20:04:56 -0500 |
commit | b107e4f771f036b214563764fcd95786f8016ee7 (patch) | |
tree | 22397105f42f30eceacdf84671d1c4d807c9dd73 /app/controllers/api/v2/media_controller.rb | |
parent | 144ecfcfc7d9974117f1563084409a9558290a60 (diff) | |
parent | c47be5bd864a1f5244f35122ba7fae31a149c73d (diff) |
Merge branch 'glitch'
Diffstat (limited to 'app/controllers/api/v2/media_controller.rb')
-rw-r--r-- | app/controllers/api/v2/media_controller.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/app/controllers/api/v2/media_controller.rb b/app/controllers/api/v2/media_controller.rb new file mode 100644 index 000000000..0c1baf01d --- /dev/null +++ b/app/controllers/api/v2/media_controller.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +class Api::V2::MediaController < Api::V1::MediaController + def create + @media_attachment = current_account.media_attachments.create!({ delay_processing: true }.merge(media_attachment_params)) + render json: @media_attachment, serializer: REST::MediaAttachmentSerializer, status: 202 + rescue Paperclip::Errors::NotIdentifiedByImageMagickError + render json: file_type_error, status: 422 + rescue Paperclip::Error + render json: processing_error, status: 500 + end +end |