summaryrefslogtreecommitdiff
path: root/app/controllers/files_controller.rb
diff options
context:
space:
mode:
authorSebastian Ziebell <sebastian.ziebell@asquera.de>2013-02-20 12:43:32 +0100
committerSebastian Ziebell <sebastian.ziebell@asquera.de>2013-02-20 12:43:32 +0100
commiteefb27f5ae0edf0c005eb8ce6da56cbd17c9aa8a (patch)
tree9dc7d17953ee7851e1934903b45faf5f18d860a2 /app/controllers/files_controller.rb
parent1b97a2eee8b89320de891e3ae8496adfa7f3a84b (diff)
parentb7ac654b88aa9b03f431d93c25e397ff2bc66a7a (diff)
downloadgitlab-ce-eefb27f5ae0edf0c005eb8ce6da56cbd17c9aa8a.tar.gz
Merge branch 'master' into fixes/api
Conflicts: spec/requests/api/projects_spec.rb
Diffstat (limited to 'app/controllers/files_controller.rb')
-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
+