diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2017-04-04 01:33:34 +0200 |
---|---|---|
committer | Eugen Rochko <eugen@zeonfederated.com> | 2017-04-04 01:33:34 +0200 |
commit | 4c53af64f0b10bc11473df5e3fd1cd7a11b755f6 (patch) | |
tree | 9bad122ae3a66b4171f48947cbb33496e2f8b2de /app/controllers/api/v1/media_controller.rb | |
parent | f722bd2387df9163760014e9555928ec487ae95f (diff) |
Fix ActionController::Parameters in API issue
Diffstat (limited to 'app/controllers/api/v1/media_controller.rb')
-rw-r--r-- | app/controllers/api/v1/media_controller.rb | 8 |
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 |