summaryrefslogtreecommitdiff
path: root/app/controllers/files_controller.rb
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-05-15 22:35:59 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-05-15 22:35:59 +0300
commit9e0246684d14e5323cfb71291faff290e2762f48 (patch)
treee9ae0f2613688ad83798ec4ee0e525d6e246b511 /app/controllers/files_controller.rb
parentced044ad249f794370ea111532a30f81a3c83408 (diff)
downloadgitlab-ce-9e0246684d14e5323cfb71291faff290e2762f48.tar.gz
Files controller handle redirect to remote storage. Added config block to carrierwave init
Diffstat (limited to 'app/controllers/files_controller.rb')
-rw-r--r--app/controllers/files_controller.rb12
1 files changed, 8 insertions, 4 deletions
diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb
index 3cd2e77322c..bf30de565ed 100644
--- a/app/controllers/files_controller.rb
+++ b/app/controllers/files_controller.rb
@@ -1,12 +1,16 @@
class FilesController < ApplicationController
def download
note = Note.find(params[:id])
+ uploader = note.attachment
- if can?(current_user, :read_project, note.project)
- uploader = note.attachment
- send_file uploader.file.path, disposition: 'attachment'
+ if uploader.file_storage?
+ if can?(current_user, :read_project, note.project)
+ send_file uploader.file.path, disposition: 'attachment'
+ else
+ not_found!
+ end
else
- not_found!
+ redirect_to uploader.url
end
end
end