~cytrogen/masto-fe

ref: f89f3a85662ce1f4e6f130748ded22821e4a7acd masto-fe/app/controllers/api/v2/media_controller.rb -rw-r--r-- 550 bytes
f89f3a85 — Claire Fix glitch-soc's thread line styling (#2214) 2 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
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: @media_attachment.not_processed? ? 202 : 200
  rescue Paperclip::Errors::NotIdentifiedByImageMagickError
    render json: file_type_error, status: 422
  rescue Paperclip::Error
    render json: processing_error, status: 500
  end
end