Skip to content
Snippets Groups Projects
Commit 2f5b2059 authored by Eugen Rochko's avatar Eugen Rochko
Browse files

Catch Paperclip errors on /api/v1/media, return early from update profile...

Catch Paperclip errors on /api/v1/media, return early from update profile service if XML given is nil
parent cdad5d32
No related branches found
No related tags found
No related merge requests found
......@@ -4,5 +4,9 @@ class Api::V1::MediaController < ApiController
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
class UpdateRemoteProfileService < BaseService
def call(author_xml, account)
return if author_xml.nil?
if author_xml.at_xpath('./poco:displayName').nil?
account.display_name = account.username
else
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment