summaryrefslogtreecommitdiff
path: root/app/controllers/projects/tree_controller.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/projects/tree_controller.rb')
-rw-r--r--app/controllers/projects/tree_controller.rb8
1 files changed, 3 insertions, 5 deletions
diff --git a/app/controllers/projects/tree_controller.rb b/app/controllers/projects/tree_controller.rb
index 7509cc29a76..eec89afe354 100644
--- a/app/controllers/projects/tree_controller.rb
+++ b/app/controllers/projects/tree_controller.rb
@@ -5,6 +5,7 @@ class Projects::TreeController < Projects::ApplicationController
include ExtractsPath
include CreatesCommit
include ActionView::Helpers::SanitizeHelper
+ include RedirectsForMissingPathOnTree
around_action :allow_gitaly_ref_name_caching, only: [:show]
@@ -19,12 +20,9 @@ class Projects::TreeController < Projects::ApplicationController
if tree.entries.empty?
if @repository.blob_at(@commit.id, @path)
- return redirect_to(
- project_blob_path(@project,
- File.join(@ref, @path))
- )
+ return redirect_to project_blob_path(@project, File.join(@ref, @path))
elsif @path.present?
- return render_404
+ return redirect_to_tree_root_for_missing_path(@project, @ref, @path)
end
end