diff options
author | Marin Jankovski <marin@gitlab.com> | 2014-07-07 17:46:57 +0400 |
---|---|---|
committer | Marin Jankovski <marin@gitlab.com> | 2014-07-07 17:46:57 +0400 |
commit | 005752e4c6485cf79b0a53583c03b5a69fe19f10 (patch) | |
tree | e940d94f5b5b0ba628794855414a4ec9015722a2 /app/controllers/projects/tree_controller.rb | |
parent | 5a67d482afd7780506c0dc2689a7d839647d5da5 (diff) |
Check if blob or tree and redirect to the correct one.
Diffstat (limited to 'app/controllers/projects/tree_controller.rb')
-rw-r--r-- | app/controllers/projects/tree_controller.rb | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/app/controllers/projects/tree_controller.rb b/app/controllers/projects/tree_controller.rb index 30c94ec6da0..4d033b36848 100644 --- a/app/controllers/projects/tree_controller.rb +++ b/app/controllers/projects/tree_controller.rb @@ -1,7 +1,14 @@ # Controller for viewing a repository's file structure class Projects::TreeController < Projects::BaseTreeController def show - return not_found! if tree.entries.empty? + + if tree.entries.empty? + if @repository.blob_at(@commit.id, @path) + redirect_to project_blob_path(@project, File.join(@ref, @path)) and return + else + return not_found! + end + end respond_to do |format| format.html |