闭社主体 forked from https://github.com/tootsuite/mastodon
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

12 lines
509 B

  1. # frozen_string_literal: true
  2. class Api::V2::MediaController < Api::V1::MediaController
  3. def create
  4. @media_attachment = current_account.media_attachments.create!({ delay_processing: true }.merge(media_attachment_params))
  5. render json: @media_attachment, serializer: REST::MediaAttachmentSerializer, status: 202
  6. rescue Paperclip::Errors::NotIdentifiedByImageMagickError
  7. render json: file_type_error, status: 422
  8. rescue Paperclip::Error
  9. render json: processing_error, status: 500
  10. end
  11. end