about summary refs log tree commit diff
path: root/app/controllers/api/v1/media_controller.rb
diff options
context:
space:
mode:
authorEugen <eugen@zeonfederated.com>2017-04-04 14:51:42 +0200
committerGitHub <noreply@github.com>2017-04-04 14:51:42 +0200
commit48dfdad49255ae4a100e01f41852e65806858fce (patch)
treea2bfe7a94bcd7a37399470b31c0453e1b489dea9 /app/controllers/api/v1/media_controller.rb
parent5b6f4fdeb4932df1704da01762cc22c63aacb20f (diff)
parented4a723a82e90fc057494e4fdec4a2074a3164c7 (diff)
Merge branch 'master' into patch-1
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