GitLab steht Mittwoch, den 23. September, zwischen 10:00 und 12:00 Uhr aufgrund von Wartungsarbeiten nicht zur Verfügung.

uploads_controller.rb 507 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
class Projects::UploadsController < Projects::ApplicationController
  layout "project"

  before_filter :project

  def show
    path = File.join(project.path_with_namespace, params[:secret])
    uploader = FileUploader.new('uploads', path)

    uploader.retrieve_from_store!(params[:filename])

    if uploader.file.exists?
      # Right now, these are always images, so we can safely render them inline.
      send_file uploader.file.path, disposition: 'inline'
    else
      not_found!
    end
  end
end