diff options
Diffstat (limited to 'app/controllers/uploads_controller.rb')
-rw-r--r-- | app/controllers/uploads_controller.rb | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/app/controllers/uploads_controller.rb b/app/controllers/uploads_controller.rb index 5cb3de3d4f5..dc882b17143 100644 --- a/app/controllers/uploads_controller.rb +++ b/app/controllers/uploads_controller.rb @@ -17,6 +17,8 @@ class UploadsController < ApplicationController end def authorize_access! + return nil unless model + authorized = case model when Note @@ -35,7 +37,7 @@ class UploadsController < ApplicationController end def authorize_create_access! - return unless model + return nil unless model # for now we support only personal snippets comments authorized = can?(current_user, :comment_personal_snippet, model) @@ -77,7 +79,12 @@ class UploadsController < ApplicationController def uploader return @uploader if defined?(@uploader) - if model.is_a?(PersonalSnippet) + case model + when nil + @uploader = PersonalFileUploader.new(nil, params[:secret]) + + @uploader.retrieve_from_store!(params[:filename]) + when PersonalSnippet @uploader = PersonalFileUploader.new(model, params[:secret]) @uploader.retrieve_from_store!(params[:filename]) |