BigW Consortium Gitlab

files_controller.rb 377 Bytes
Newer Older
1 2
class FilesController < ApplicationController
  def download
3
    note = Note.find(params[:id])
4
    uploader = note.attachment
5

6 7 8 9 10 11
    if uploader.file_storage?
      if can?(current_user, :read_project, note.project)
        send_file uploader.file.path, disposition: 'attachment'
      else
        not_found!
      end
12
    else
13
      redirect_to uploader.url
14
    end
15 16 17
  end
end