Welcome to mirror list, hosted at ThFree Co, Russian Federation.

send_file_upload.rb « concerns « controllers « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: d4de4cf1fda68f7f7e58d73b7c099ec5334c8619 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
module SendFileUpload
  def send_upload(file_upload, send_params: {}, redirect_params: {}, attachment: nil)
    if attachment
      redirect_params[:query] = { "response-content-disposition" => "attachment;filename=#{attachment.inspect}" }
      send_params.merge!(filename: attachment, disposition: 'attachment')
    end

    if file_upload.file_storage?
      send_file file_upload.path, send_params
    else
      redirect_to file_upload.url(**redirect_params)
    end
  end
end