about summary refs log tree commit diff
path: root/app/controllers/api/v1/media_controller.rb
diff options
context:
space:
mode:
authorhalna_Tanaguru <fhalna@oceaneconsulting.com>2017-04-04 12:06:53 +0200
committerGitHub <noreply@github.com>2017-04-04 12:06:53 +0200
commit3abb0f7bc708ae8ca387aee8560b9558f8b209ba (patch)
tree6014fdec3201d9e40fa244b821bdaffc83bfa131 /app/controllers/api/v1/media_controller.rb
parent3f30ae1f97717177f29711d5b99d7970c6b75b3e (diff)
parenteb023beb4975a019d6a3b3091483c91c2c837bbd (diff)
Merge branch 'master' into development
Diffstat (limited to 'app/controllers/api/v1/media_controller.rb')
-rw-r--r--app/controllers/api/v1/media_controller.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/app/controllers/api/v1/media_controller.rb b/app/controllers/api/v1/media_controller.rb
index f8139ade7..aed3578d7 100644
--- a/app/controllers/api/v1/media_controller.rb
+++ b/app/controllers/api/v1/media_controller.rb
@@ -10,10 +10,16 @@ class Api::V1::MediaController < ApiController
   respond_to :json
 
   def create
-    @media = MediaAttachment.create!(account: current_user.account, file: params[:file])
+    @media = MediaAttachment.create!(account: current_user.account, file: media_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
+
+  private
+
+  def media_params
+    params.permit(:file)
+  end
 end