summaryrefslogtreecommitdiff
path: root/app/controllers
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-02-16 12:45:20 +0000
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-02-16 12:45:20 +0000
commitfa3cc1dd24fed0cd3b041e469cada054fda479ab (patch)
tree8b1b96f38209f9a81fca0f287f5192382a9d65dc /app/controllers
parentb7297285369171c95b006e49d6da7bc84b969fc8 (diff)
parentf6cc71bc36283223a10f3004121be34f06547d94 (diff)
downloadgitlab-ce-fa3cc1dd24fed0cd3b041e469cada054fda479ab.tar.gz
Merge branch 'features/attachment_server' of /home/git/repositories/gitlab/gitlabhq
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/files_controller.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb
new file mode 100644
index 00000000000..3cd2e77322c
--- /dev/null
+++ b/app/controllers/files_controller.rb
@@ -0,0 +1,13 @@
+class FilesController < ApplicationController
+ def download
+ note = Note.find(params[:id])
+
+ if can?(current_user, :read_project, note.project)
+ uploader = note.attachment
+ send_file uploader.file.path, disposition: 'attachment'
+ else
+ not_found!
+ end
+ end
+end
+