diff options
author | Stan Hu <stanhu@gmail.com> | 2015-07-21 02:55:45 +0300 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2015-07-22 00:12:43 +0300 |
commit | 643557dabccbb3a503b0867ae44ec5701759d2a8 (patch) | |
tree | d50c3315b5e4a7461deac389a09a3aceb5b60e03 /app/controllers/projects/tree_controller.rb | |
parent | 57f9a1ccd4e97747cf09ffd98e8c44056c0846e5 (diff) |
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.rb | 4 |
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 |