summaryrefslogtreecommitdiff
path: root/app/controllers/projects/tree_controller.rb
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2015-07-20 16:55:45 -0700
committerStan Hu <stanhu@gmail.com>2015-07-21 14:12:43 -0700
commit643557dabccbb3a503b0867ae44ec5701759d2a8 (patch)
treed50c3315b5e4a7461deac389a09a3aceb5b60e03 /app/controllers/projects/tree_controller.rb
parent57f9a1ccd4e97747cf09ffd98e8c44056c0846e5 (diff)
downloadgitlab-ce-643557dabccbb3a503b0867ae44ec5701759d2a8.tar.gz
Fix 404 error in files view after deleting the last file in a repository
Closes #1362
Diffstat (limited to 'app/controllers/projects/tree_controller.rb')
-rw-r--r--app/controllers/projects/tree_controller.rb4
1 files changed, 3 insertions, 1 deletions
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