gitlab-org--gitlab-foss/app/controllers/projects/tree_controller.rb
Vinnie Okada 2a9eed6620 Merge branch 'master' into rails-4.1.9
Conflicts:
	app/views/projects/commits/_commit.html.haml
	app/views/projects/issues/_issue.html.haml
	app/views/projects/issues/_issue_context.html.haml
	app/views/projects/merge_requests/_merge_request.html.haml
	app/views/projects/merge_requests/show/_context.html.haml
2015-02-21 12:55:28 -07:00

27 lines
749 B
Ruby

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