forked from fedi/mastodon
9aecc0f48a
resources that require a user context vs those that don't (such as public timeline) /api/v1/statuses/public -> /api/v1/timelines/public /api/v1/statuses/home -> /api/v1/timelines/home /api/v1/statuses/mentions -> /api/v1/timelines/mentions /api/v1/statuses/tag/:tag -> /api/v1/timelines/tag/:tag
15 lines
534 B
Ruby
15 lines
534 B
Ruby
class Api::V1::MediaController < ApiController
|
|
before_action -> { doorkeeper_authorize! :write }
|
|
before_action :require_user!
|
|
|
|
respond_to :json
|
|
|
|
def create
|
|
@media = MediaAttachment.create!(account: current_user.account, file: params[:file])
|
|
rescue Paperclip::Errors::NotIdentifiedByImageMagickError
|
|
render json: { error: 'File type of uploaded media could not be verified' }, status: 422
|
|
rescue Paperclip::Error
|
|
render json: { error: 'Error processing thumbnail for uploaded media' }, status: 500
|
|
end
|
|
end
|