mirror of
https://github.com/wahyd4/gitlabhq.git
synced 2026-08-15 15:46:08 +10:00
# Conflicts: # app/controllers/files_controller.rb # app/controllers/projects/uploads_controller.rb # app/uploaders/attachment_uploader.rb
16 lines
528 B
Ruby
16 lines
528 B
Ruby
class UploadsController < ApplicationController
|
|
def show
|
|
model = params[:model].camelize.constantize.find(params[:id])
|
|
uploader = model.send(params[:mounted_as])
|
|
|
|
return not_found! if model.respond_to?(:project) && !can?(current_user, :read_project, model.project)
|
|
|
|
return redirect_to uploader.url unless uploader.file_storage?
|
|
|
|
return not_found! unless uploader.file.exists?
|
|
|
|
disposition = uploader.image? ? 'inline' : 'attachment'
|
|
send_file uploader.file.path, disposition: disposition
|
|
end
|
|
end
|