gitlab-org--gitlab-foss/app/controllers/projects/tree_controller.rb

25 lines
660 B
Ruby
Raw Normal View History

2012-09-17 16:38:59 +00:00
# Controller for viewing a repository's file structure
class Projects::TreeController < Projects::ApplicationController
include ExtractsPath
before_filter :assign_ref_vars
before_filter :authorize_download_code!
before_filter :require_non_empty_project, except: [:new, :create]
def show
if tree.entries.empty?
if @repository.blob_at(@commit.id, @path)
redirect_to project_blob_path(@project, File.join(@ref, @path)) and return
else
return not_found!
end
end
2013-10-01 14:00:28 +00:00
2012-09-17 16:38:59 +00:00
respond_to do |format|
format.html
# Disable cache so browser history works
format.js { no_cache_headers }
end
end
end