From 643557dabccbb3a503b0867ae44ec5701759d2a8 Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Mon, 20 Jul 2015 16:55:45 -0700 Subject: Fix 404 error in files view after deleting the last file in a repository Closes #1362 --- app/controllers/projects/tree_controller.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'app') diff --git a/app/controllers/projects/tree_controller.rb b/app/controllers/projects/tree_controller.rb index b659e15f242..92e4bc16d9d 100644 --- a/app/controllers/projects/tree_controller.rb +++ b/app/controllers/projects/tree_controller.rb @@ -7,13 +7,15 @@ class Projects::TreeController < Projects::ApplicationController before_action :authorize_download_code! def show + return not_found! unless @repository.commit(@ref) + 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 + elsif @path.present? return not_found! end end -- cgit v1.2.3