Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Tatuya Kamada
gitlab-ce
Commits
005752e4
Commit
005752e4
authored
Jul 07, 2014
by
Marin Jankovski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Check if blob or tree and redirect to the correct one.
parent
5a67d482
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
4 deletions
+15
-4
app/controllers/projects/blob_controller.rb
app/controllers/projects/blob_controller.rb
+7
-3
app/controllers/projects/tree_controller.rb
app/controllers/projects/tree_controller.rb
+8
-1
No files found.
app/controllers/projects/blob_controller.rb
View file @
005752e4
...
...
@@ -30,8 +30,12 @@ class Projects::BlobController < Projects::ApplicationController
def
blob
@blob
||=
@repository
.
blob_at
(
@commit
.
id
,
@path
)
return
not_found!
unless
@blob
if
@blob
@blob
elsif
tree
.
entries
.
any?
redirect_to
project_tree_path
(
@project
,
File
.
join
(
@ref
,
@path
))
and
return
else
return
not_found!
end
end
end
app/controllers/projects/tree_controller.rb
View file @
005752e4
# 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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment