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
iv
gitlab-ce
Commits
e38e2ce2
Commit
e38e2ce2
authored
Mar 06, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3154 from hiroponz/fix-routing-error
Fix routing error
parents
d03af842
83435e3d
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
21 additions
and
15 deletions
+21
-15
config/routes.rb
config/routes.rb
+3
-3
features/steps/project/project_network_graph.rb
features/steps/project/project_network_graph.rb
+2
-0
lib/extracts_path.rb
lib/extracts_path.rb
+0
-6
spec/controllers/commits_controller_spec.rb
spec/controllers/commits_controller_spec.rb
+1
-1
spec/routing/project_routing_spec.rb
spec/routing/project_routing_spec.rb
+15
-5
No files found.
config/routes.rb
View file @
e38e2ce2
...
@@ -165,7 +165,7 @@ Gitlab::Application.routes.draw do
...
@@ -165,7 +165,7 @@ Gitlab::Application.routes.draw do
#
#
# Project Area
# Project Area
#
#
resources
:projects
,
constraints:
{
id:
/
[a-zA-Z.0-9_\-\/
]+/
},
except:
[
:new
,
:create
,
:index
],
path:
"/"
do
resources
:projects
,
constraints:
{
id:
/
(?:[a-zA-Z.0-9_\-]+\/)?[a-zA-Z.0-9_\-
]+/
},
except:
[
:new
,
:create
,
:index
],
path:
"/"
do
member
do
member
do
get
"wall"
get
"wall"
get
"files"
get
"files"
...
@@ -174,10 +174,10 @@ Gitlab::Application.routes.draw do
...
@@ -174,10 +174,10 @@ Gitlab::Application.routes.draw do
resources
:blob
,
only:
[
:show
],
constraints:
{
id:
/.+/
}
resources
:blob
,
only:
[
:show
],
constraints:
{
id:
/.+/
}
resources
:tree
,
only:
[
:show
,
:edit
,
:update
],
constraints:
{
id:
/.+/
}
resources
:tree
,
only:
[
:show
,
:edit
,
:update
],
constraints:
{
id:
/.+/
}
resources
:commit
,
only:
[
:show
],
constraints:
{
id:
/[[:alnum:]]{6,40}/
}
resources
:commit
,
only:
[
:show
],
constraints:
{
id:
/[[:alnum:]]{6,40}/
}
resources
:commits
,
only:
[
:show
],
constraints:
{
id:
/
.+
/
}
resources
:commits
,
only:
[
:show
],
constraints:
{
id:
/
(?:[^.]|\.(?!atom$))+/
,
format:
/atom
/
}
resources
:compare
,
only:
[
:index
,
:create
]
resources
:compare
,
only:
[
:index
,
:create
]
resources
:blame
,
only:
[
:show
],
constraints:
{
id:
/.+/
}
resources
:blame
,
only:
[
:show
],
constraints:
{
id:
/.+/
}
resources
:graph
,
only:
[
:show
],
constraints:
{
id:
/
.+
/
}
resources
:graph
,
only:
[
:show
],
constraints:
{
id:
/
(?:[^.]|\.(?!json$))+/
,
format:
/json
/
}
match
"/compare/:from...:to"
=>
"compare#show"
,
as:
"compare"
,
match
"/compare/:from...:to"
=>
"compare#show"
,
as:
"compare"
,
:via
=>
[
:get
,
:post
],
constraints:
{
from:
/.+/
,
to:
/.+/
}
:via
=>
[
:get
,
:post
],
constraints:
{
from:
/.+/
,
to:
/.+/
}
...
...
features/steps/project/project_network_graph.rb
View file @
e38e2ce2
...
@@ -27,6 +27,7 @@ class ProjectNetworkGraph < Spinach::FeatureSteps
...
@@ -27,6 +27,7 @@ class ProjectNetworkGraph < Spinach::FeatureSteps
And
'I switch ref to "stable"'
do
And
'I switch ref to "stable"'
do
page
.
select
'stable'
,
:from
=>
'ref'
page
.
select
'stable'
,
:from
=>
'ref'
sleep
2
end
end
And
'page should select "stable" in select box'
do
And
'page should select "stable" in select box'
do
...
@@ -44,6 +45,7 @@ class ProjectNetworkGraph < Spinach::FeatureSteps
...
@@ -44,6 +45,7 @@ class ProjectNetworkGraph < Spinach::FeatureSteps
fill_in
'q'
,
:with
=>
'98d6492'
fill_in
'q'
,
:with
=>
'98d6492'
find
(
'button'
).
click
find
(
'button'
).
click
end
end
sleep
2
end
end
And
'page should have "v2.1.0" on graph'
do
And
'page should have "v2.1.0" on graph'
do
...
...
lib/extracts_path.rb
View file @
e38e2ce2
...
@@ -105,12 +105,6 @@ module ExtractsPath
...
@@ -105,12 +105,6 @@ module ExtractsPath
# Automatically renders `not_found!` if a valid tree path could not be
# Automatically renders `not_found!` if a valid tree path could not be
# resolved (e.g., when a user inserts an invalid path or ref).
# resolved (e.g., when a user inserts an invalid path or ref).
def
assign_ref_vars
def
assign_ref_vars
# Handle formats embedded in the id
if
params
[
:id
].
ends_with?
(
'.atom'
)
params
[
:id
].
gsub!
(
/\.atom$/
,
''
)
request
.
format
=
:atom
end
path
=
CGI
::
unescape
(
request
.
fullpath
.
dup
)
path
=
CGI
::
unescape
(
request
.
fullpath
.
dup
)
@ref
,
@path
=
extract_ref
(
path
)
@ref
,
@path
=
extract_ref
(
path
)
...
...
spec/controllers/commits_controller_spec.rb
View file @
e38e2ce2
...
@@ -13,7 +13,7 @@ describe CommitsController do
...
@@ -13,7 +13,7 @@ describe CommitsController do
describe
"GET show"
do
describe
"GET show"
do
context
"as atom feed"
do
context
"as atom feed"
do
it
"should render as atom"
do
it
"should render as atom"
do
get
:show
,
project_id:
project
.
path
,
id:
"master
.
atom"
get
:show
,
project_id:
project
.
path
,
id:
"master
"
,
format:
"
atom"
response
.
should
be_success
response
.
should
be_success
response
.
content_type
.
should
==
'application/atom+xml'
response
.
content_type
.
should
==
'application/atom+xml'
end
end
...
...
spec/routing/project_routing_spec.rb
View file @
e38e2ce2
...
@@ -56,7 +56,6 @@ end
...
@@ -56,7 +56,6 @@ end
# projects POST /projects(.:format) projects#create
# projects POST /projects(.:format) projects#create
# new_project GET /projects/new(.:format) projects#new
# new_project GET /projects/new(.:format) projects#new
# wall_project GET /:id/wall(.:format) projects#wall
# wall_project GET /:id/wall(.:format) projects#wall
# graph_project GET /:id/graph(.:format) projects#graph
# files_project GET /:id/files(.:format) projects#files
# files_project GET /:id/files(.:format) projects#files
# edit_project GET /:id/edit(.:format) projects#edit
# edit_project GET /:id/edit(.:format) projects#edit
# project GET /:id(.:format) projects#show
# project GET /:id(.:format) projects#show
...
@@ -75,10 +74,6 @@ describe ProjectsController, "routing" do
...
@@ -75,10 +74,6 @@ describe ProjectsController, "routing" do
get
(
"/gitlabhq/wall"
).
should
route_to
(
'projects#wall'
,
id:
'gitlabhq'
)
get
(
"/gitlabhq/wall"
).
should
route_to
(
'projects#wall'
,
id:
'gitlabhq'
)
end
end
it
"to #graph"
do
get
(
"/gitlabhq/graph/master"
).
should
route_to
(
'graph#show'
,
project_id:
'gitlabhq'
,
id:
'master'
)
end
it
"to #files"
do
it
"to #files"
do
get
(
"/gitlabhq/files"
).
should
route_to
(
'projects#files'
,
id:
'gitlabhq'
)
get
(
"/gitlabhq/files"
).
should
route_to
(
'projects#files'
,
id:
'gitlabhq'
)
end
end
...
@@ -202,6 +197,7 @@ describe RefsController, "routing" do
...
@@ -202,6 +197,7 @@ describe RefsController, "routing" do
it
"to #logs_tree"
do
it
"to #logs_tree"
do
get
(
"/gitlabhq/refs/stable/logs_tree"
).
should
route_to
(
'refs#logs_tree'
,
project_id:
'gitlabhq'
,
id:
'stable'
)
get
(
"/gitlabhq/refs/stable/logs_tree"
).
should
route_to
(
'refs#logs_tree'
,
project_id:
'gitlabhq'
,
id:
'stable'
)
get
(
"/gitlabhq/refs/stable/logs_tree/foo/bar/baz"
).
should
route_to
(
'refs#logs_tree'
,
project_id:
'gitlabhq'
,
id:
'stable'
,
path:
'foo/bar/baz'
)
get
(
"/gitlabhq/refs/stable/logs_tree/foo/bar/baz"
).
should
route_to
(
'refs#logs_tree'
,
project_id:
'gitlabhq'
,
id:
'stable'
,
path:
'foo/bar/baz'
)
get
(
"/gitlab/gitlabhq/refs/stable/logs_tree/files.scss"
).
should
route_to
(
'refs#logs_tree'
,
project_id:
'gitlab/gitlabhq'
,
id:
'stable'
,
path:
'files.scss'
)
end
end
end
end
...
@@ -301,6 +297,10 @@ describe CommitsController, "routing" do
...
@@ -301,6 +297,10 @@ describe CommitsController, "routing" do
let
(
:actions
)
{
[
:show
]
}
let
(
:actions
)
{
[
:show
]
}
let
(
:controller
)
{
'commits'
}
let
(
:controller
)
{
'commits'
}
end
end
it
"to #show"
do
get
(
"/gitlab/gitlabhq/commits/master.atom"
).
should
route_to
(
'commits#show'
,
project_id:
'gitlab/gitlabhq'
,
id:
"master"
,
format:
"atom"
)
end
end
end
# project_team_members GET /:project_id/team_members(.:format) team_members#index
# project_team_members GET /:project_id/team_members(.:format) team_members#index
...
@@ -385,6 +385,7 @@ end
...
@@ -385,6 +385,7 @@ end
describe
BlameController
,
"routing"
do
describe
BlameController
,
"routing"
do
it
"to #show"
do
it
"to #show"
do
get
(
"/gitlabhq/blame/master/app/models/project.rb"
).
should
route_to
(
'blame#show'
,
project_id:
'gitlabhq'
,
id:
'master/app/models/project.rb'
)
get
(
"/gitlabhq/blame/master/app/models/project.rb"
).
should
route_to
(
'blame#show'
,
project_id:
'gitlabhq'
,
id:
'master/app/models/project.rb'
)
get
(
"/gitlab/gitlabhq/blame/master/files.scss"
).
should
route_to
(
'blame#show'
,
project_id:
'gitlab/gitlabhq'
,
id:
'master/files.scss'
)
end
end
end
end
...
@@ -393,6 +394,7 @@ describe BlobController, "routing" do
...
@@ -393,6 +394,7 @@ describe BlobController, "routing" do
it
"to #show"
do
it
"to #show"
do
get
(
"/gitlabhq/blob/master/app/models/project.rb"
).
should
route_to
(
'blob#show'
,
project_id:
'gitlabhq'
,
id:
'master/app/models/project.rb'
)
get
(
"/gitlabhq/blob/master/app/models/project.rb"
).
should
route_to
(
'blob#show'
,
project_id:
'gitlabhq'
,
id:
'master/app/models/project.rb'
)
get
(
"/gitlabhq/blob/master/app/models/compare.rb"
).
should
route_to
(
'blob#show'
,
project_id:
'gitlabhq'
,
id:
'master/app/models/compare.rb'
)
get
(
"/gitlabhq/blob/master/app/models/compare.rb"
).
should
route_to
(
'blob#show'
,
project_id:
'gitlabhq'
,
id:
'master/app/models/compare.rb'
)
get
(
"/gitlab/gitlabhq/blob/master/files.scss"
).
should
route_to
(
'blob#show'
,
project_id:
'gitlab/gitlabhq'
,
id:
'master/files.scss'
)
end
end
end
end
...
@@ -400,6 +402,7 @@ end
...
@@ -400,6 +402,7 @@ end
describe
TreeController
,
"routing"
do
describe
TreeController
,
"routing"
do
it
"to #show"
do
it
"to #show"
do
get
(
"/gitlabhq/tree/master/app/models/project.rb"
).
should
route_to
(
'tree#show'
,
project_id:
'gitlabhq'
,
id:
'master/app/models/project.rb'
)
get
(
"/gitlabhq/tree/master/app/models/project.rb"
).
should
route_to
(
'tree#show'
,
project_id:
'gitlabhq'
,
id:
'master/app/models/project.rb'
)
get
(
"/gitlab/gitlabhq/tree/master/files.scss"
).
should
route_to
(
'tree#show'
,
project_id:
'gitlab/gitlabhq'
,
id:
'master/files.scss'
)
end
end
end
end
...
@@ -420,3 +423,10 @@ describe CompareController, "routing" do
...
@@ -420,3 +423,10 @@ describe CompareController, "routing" do
get
(
"/gitlabhq/compare/issue/1234...stable"
).
should
route_to
(
'compare#show'
,
project_id:
'gitlabhq'
,
from:
'issue/1234'
,
to:
'stable'
)
get
(
"/gitlabhq/compare/issue/1234...stable"
).
should
route_to
(
'compare#show'
,
project_id:
'gitlabhq'
,
from:
'issue/1234'
,
to:
'stable'
)
end
end
end
end
describe
GraphController
,
"routing"
do
it
"to #show"
do
get
(
"/gitlabhq/graph/master"
).
should
route_to
(
'graph#show'
,
project_id:
'gitlabhq'
,
id:
'master'
)
get
(
"/gitlabhq/graph/master.json"
).
should
route_to
(
'graph#show'
,
project_id:
'gitlabhq'
,
id:
'master'
,
format:
"json"
)
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