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
Léo-Paul Géneau
gitlab-ce
Commits
00c4e141
Commit
00c4e141
authored
Apr 13, 2017
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove format from end of URL for URLs that take a ref or path
parent
41acc87f
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
71 additions
and
102 deletions
+71
-102
config/routes/project.rb
config/routes/project.rb
+0
-32
config/routes/repository.rb
config/routes/repository.rb
+70
-69
spec/routing/project_routing_spec.rb
spec/routing/project_routing_spec.rb
+1
-1
No files found.
config/routes/project.rb
View file @
00c4e141
...
@@ -42,29 +42,6 @@ constraints(ProjectUrlConstrainer.new) do
...
@@ -42,29 +42,6 @@ constraints(ProjectUrlConstrainer.new) do
resources
:domains
,
only:
[
:show
,
:new
,
:create
,
:destroy
],
controller:
'pages_domains'
,
constraints:
{
id:
/[^\/]+/
}
resources
:domains
,
only:
[
:show
,
:new
,
:create
,
:destroy
],
controller:
'pages_domains'
,
constraints:
{
id:
/[^\/]+/
}
end
end
resources
:compare
,
only:
[
:index
,
:create
]
do
collection
do
get
:diff_for_path
end
end
get
'/compare/:from...:to'
,
to:
'compare#show'
,
as:
'compare'
,
constraints:
{
from:
/.+/
,
to:
/.+/
}
# Don't use format parameter as file extension (old 3.0.x behavior)
# See http://guides.rubyonrails.org/routing.html#route-globbing-and-wildcard-segments
scope
format:
false
do
resources
:network
,
only:
[
:show
],
constraints:
{
id:
Gitlab
::
Regex
.
git_reference_regex
}
resources
:graphs
,
only:
[
:show
],
constraints:
{
id:
Gitlab
::
Regex
.
git_reference_regex
}
do
member
do
get
:charts
get
:commits
get
:ci
get
:languages
end
end
end
resources
:snippets
,
concerns: :awardable
,
constraints:
{
id:
/\d+/
}
do
resources
:snippets
,
concerns: :awardable
,
constraints:
{
id:
/\d+/
}
do
member
do
member
do
get
'raw'
get
'raw'
...
@@ -128,15 +105,6 @@ constraints(ProjectUrlConstrainer.new) do
...
@@ -128,15 +105,6 @@ constraints(ProjectUrlConstrainer.new) do
end
end
end
end
resources
:branches
,
only:
[
:index
,
:new
,
:create
,
:destroy
],
constraints:
{
id:
Gitlab
::
Regex
.
git_reference_regex
}
delete
:merged_branches
,
controller:
'branches'
,
action: :destroy_all_merged
resources
:tags
,
only:
[
:index
,
:show
,
:new
,
:create
,
:destroy
],
constraints:
{
id:
Gitlab
::
Regex
.
git_reference_regex
}
do
resource
:release
,
only:
[
:edit
,
:update
]
end
resources
:protected_branches
,
only:
[
:index
,
:show
,
:create
,
:update
,
:destroy
],
constraints:
{
id:
Gitlab
::
Regex
.
git_reference_regex
}
resources
:protected_tags
,
only:
[
:index
,
:show
,
:create
,
:update
,
:destroy
],
constraints:
{
id:
Gitlab
::
Regex
.
git_reference_regex
}
resources
:variables
,
only:
[
:index
,
:show
,
:update
,
:create
,
:destroy
]
resources
:variables
,
only:
[
:index
,
:show
,
:update
,
:create
,
:destroy
]
resources
:triggers
,
only:
[
:index
,
:create
,
:edit
,
:update
,
:destroy
]
do
resources
:triggers
,
only:
[
:index
,
:create
,
:edit
,
:update
,
:destroy
]
do
member
do
member
do
...
...
config/routes/repository.rb
View file @
00c4e141
# All routing related to reposito
t
y browsing
# All routing related to reposito
r
y browsing
resource
:repository
,
only:
[
:create
]
do
resource
:repository
,
only:
[
:create
]
do
member
do
member
do
...
@@ -6,7 +6,18 @@ resource :repository, only: [:create] do
...
@@ -6,7 +6,18 @@ resource :repository, only: [:create] do
end
end
end
end
resources
:refs
,
only:
[]
do
# Don't use format parameter as file extension (old 3.0.x behavior)
# See http://guides.rubyonrails.org/routing.html#route-globbing-and-wildcard-segments
scope
format:
false
do
get
'/compare/:from...:to'
,
to:
'compare#show'
,
as:
'compare'
,
constraints:
{
from:
/.+/
,
to:
/.+/
}
resources
:compare
,
only:
[
:index
,
:create
]
do
collection
do
get
:diff_for_path
end
end
resources
:refs
,
only:
[]
do
collection
do
collection
do
get
'switch'
get
'switch'
end
end
...
@@ -16,73 +27,63 @@ resources :refs, only: [] do
...
@@ -16,73 +27,63 @@ resources :refs, only: [] do
get
'logs_tree'
,
constraints:
{
id:
Gitlab
::
Regex
.
git_reference_regex
}
get
'logs_tree'
,
constraints:
{
id:
Gitlab
::
Regex
.
git_reference_regex
}
# Directories with leading dots erroneously get rejected if git
# Directories with leading dots erroneously get rejected if git
# ref regex used in constraints. Regex verification now done in controller.
# ref regex used in constraints. Regex verification now done in controller.
get
'logs_tree/*path'
=>
'refs#logs_tree'
,
as: :logs_fil
e
,
constraints:
{
get
'logs_tree/*path'
,
action: :logs_tree
,
as: :logs_file
,
format:
fals
e
,
constraints:
{
id:
/.*/
,
id:
/.*/
,
path:
/.*/
path:
/.*/
}
}
end
end
end
end
get
'/new/*id'
,
to:
'blob#new'
,
constraints:
{
id:
/.+/
},
as:
'new_blob'
scope
constraints:
{
id:
Gitlab
::
Regex
.
git_reference_regex
}
do
post
'/create/*id'
,
to:
'blob#create'
,
constraints:
{
id:
/.+/
},
as:
'create_blob'
resources
:network
,
only:
[
:show
]
get
'/edit/*id'
,
to:
'blob#edit'
,
constraints:
{
id:
/.+/
},
as:
'edit_blob'
put
'/update/*id'
,
to:
'blob#update'
,
constraints:
{
id:
/.+/
},
as:
'update_blob'
resources
:graphs
,
only:
[
:show
]
do
post
'/preview/*id'
,
to:
'blob#preview'
,
constraints:
{
id:
/.+/
},
as:
'preview_blob'
member
do
get
:charts
get
:commits
get
:ci
get
:languages
end
end
resources
:branches
,
only:
[
:index
,
:new
,
:create
,
:destroy
]
delete
:merged_branches
,
controller:
'branches'
,
action: :destroy_all_merged
resources
:tags
,
only:
[
:index
,
:show
,
:new
,
:create
,
:destroy
]
do
resource
:release
,
only:
[
:edit
,
:update
]
end
scope
(
'/blob/*id'
,
as: :blob
,
controller: :blob
,
constraints:
{
id:
/.+/
,
format:
false
})
do
resources
:protected_branches
,
only:
[
:index
,
:show
,
:create
,
:update
,
:destroy
]
resources
:protected_tags
,
only:
[
:index
,
:show
,
:create
,
:update
,
:destroy
]
end
scope
constraints:
{
id:
/.+/
}
do
scope
controller: :blob
do
get
'/new/*id'
,
action: :new
,
as: :new_blob
post
'/create/*id'
,
action: :create
,
as: :create_blob
get
'/edit/*id'
,
action: :edit
,
as: :edit_blob
put
'/update/*id'
,
action: :update
,
as: :update_blob
post
'/preview/*id'
,
action: :preview
,
as: :preview_blob
scope
path:
'/blob/*id'
,
as: :blob
do
get
:diff
get
:diff
get
'/'
,
action: :show
get
'/'
,
action: :show
delete
'/'
,
action: :destroy
delete
'/'
,
action: :destroy
post
'/'
,
action: :create
post
'/'
,
action: :create
put
'/'
,
action: :update
put
'/'
,
action: :update
end
end
end
get
(
'/raw/*id'
,
to:
'raw#show'
,
constraints:
{
id:
/.+/
,
format:
/(html|js)/
},
as: :raw
)
get
(
'/tree/*id'
,
to:
'tree#show'
,
constraints:
{
id:
/.+/
,
format:
/(html|js)/
},
as: :tree
)
get
(
'/find_file/*id'
,
to:
'find_file#show'
,
constraints:
{
id:
/.+/
,
format:
/html/
},
as: :find_file
)
get
(
get
'/tree/*id'
,
to:
'tree#show'
,
as: :tree
'/files/*id'
,
get
'/raw/*id'
,
to:
'raw#show'
,
as: :raw
to:
'find_file#list'
,
get
'/blame/*id'
,
to:
'blame#show'
,
as: :blame
constraints:
{
id:
/(?:[^.]|\.(?!json$))+/
,
format:
/json/
},
get
'/commits/*id'
,
to:
'commits#show'
,
as: :commits
as: :files
)
post
(
post
'/create_dir/*id'
,
to:
'tree#create_dir'
,
as: :create_dir
'/create_dir/*id'
,
to:
'tree#create_dir'
,
constraints:
{
id:
/.+/
},
as:
'create_dir'
)
get
(
scope
controller: :find_file
do
'/blame/*id'
,
get
'/find_file/*id'
,
action: :show
,
as: :find_file
to:
'blame#show'
,
constraints:
{
id:
/.+/
,
format:
/(html|js)/
},
as: :blame
)
# File/dir history
get
'/files/*id'
,
action: :list
,
as: :files
get
(
end
'/commits/*id'
,
end
to:
'commits#show'
,
end
constraints:
{
id:
/.+/
,
format:
false
},
as: :commits
)
spec/routing/project_routing_spec.rb
View file @
00c4e141
...
@@ -484,7 +484,7 @@ describe 'project routing' do
...
@@ -484,7 +484,7 @@ describe 'project routing' do
end
end
it
'to #list'
do
it
'to #list'
do
expect
(
get
(
'/gitlab/gitlabhq/files/master.json'
)).
to
route_to
(
'projects/find_file#list'
,
namespace_id:
'gitlab'
,
project_id:
'gitlabhq'
,
id:
'master
'
,
format:
'
json'
)
expect
(
get
(
'/gitlab/gitlabhq/files/master.json'
)).
to
route_to
(
'projects/find_file#list'
,
namespace_id:
'gitlab'
,
project_id:
'gitlabhq'
,
id:
'master
.
json'
)
end
end
end
end
...
...
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