BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
c9abdadd
Unverified
Commit
c9abdadd
authored
Mar 14, 2017
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ensure dots in project path is allowed in the commits API
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
e52529e2
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
17 deletions
+19
-17
commits.rb
lib/api/commits.rb
+1
-1
commits.rb
lib/api/v3/commits.rb
+1
-1
commits_spec.rb
spec/requests/api/commits_spec.rb
+9
-8
commits_spec.rb
spec/requests/api/v3/commits_spec.rb
+8
-7
No files found.
lib/api/commits.rb
View file @
c9abdadd
...
...
@@ -10,7 +10,7 @@ module API
params
do
requires
:id
,
type:
String
,
desc:
'The ID of a project'
end
resource
:projects
do
resource
:projects
,
requirements:
{
id:
/.+/
}
do
desc
'Get a project repository commits'
do
success
Entities
::
RepoCommit
end
...
...
lib/api/v3/commits.rb
View file @
c9abdadd
...
...
@@ -11,7 +11,7 @@ module API
params
do
requires
:id
,
type:
String
,
desc:
'The ID of a project'
end
resource
:projects
do
resource
:projects
,
requirements:
{
id:
/.+/
}
do
desc
'Get a project repository commits'
do
success
::
API
::
Entities
::
RepoCommit
end
...
...
spec/requests/api/commits_spec.rb
View file @
c9abdadd
...
...
@@ -178,7 +178,7 @@ describe API::Commits, api: true do
end
end
describe
"
Create a commit with multiple files and action
s"
do
describe
"
POST /projects/:id/repository/commit
s"
do
let!
(
:url
)
{
"/projects/
#{
project
.
id
}
/repository/commits"
}
it
'returns a 403 unauthorized for user without permissions'
do
...
...
@@ -193,7 +193,7 @@ describe API::Commits, api: true do
expect
(
response
).
to
have_http_status
(
400
)
end
context
:create
do
describe
'create'
do
let
(
:message
)
{
'Created file'
}
let!
(
:invalid_c_params
)
do
{
...
...
@@ -237,8 +237,9 @@ describe API::Commits, api: true do
expect
(
response
).
to
have_http_status
(
400
)
end
context
'with project path in URL'
do
let
(
:url
)
{
"/projects/
#{
project
.
full_path
.
gsub
(
'/'
,
'%2F'
)
}
/repository/commits"
}
context
'with project path containing a dot in URL'
do
let!
(
:user
)
{
create
(
:user
,
username:
'foo.bar'
)
}
let
(
:url
)
{
"/projects/
#{
CGI
.
escape
(
project
.
full_path
)
}
/repository/commits"
}
it
'a new file in project repo'
do
post
api
(
url
,
user
),
valid_c_params
...
...
@@ -248,7 +249,7 @@ describe API::Commits, api: true do
end
end
context
:delete
do
describe
'delete'
do
let
(
:message
)
{
'Deleted file'
}
let!
(
:invalid_d_params
)
do
{
...
...
@@ -289,7 +290,7 @@ describe API::Commits, api: true do
end
end
context
:move
do
describe
'move'
do
let
(
:message
)
{
'Moved file'
}
let!
(
:invalid_m_params
)
do
{
...
...
@@ -334,7 +335,7 @@ describe API::Commits, api: true do
end
end
context
:update
do
describe
'update'
do
let
(
:message
)
{
'Updated file'
}
let!
(
:invalid_u_params
)
do
{
...
...
@@ -377,7 +378,7 @@ describe API::Commits, api: true do
end
end
context
"multiple operations"
do
describe
'multiple operations'
do
let
(
:message
)
{
'Multiple actions'
}
let!
(
:invalid_mo_params
)
do
{
...
...
spec/requests/api/v3/commits_spec.rb
View file @
c9abdadd
...
...
@@ -88,7 +88,7 @@ describe API::V3::Commits, api: true do
end
end
describe
"
Create a commit with multiple files and action
s"
do
describe
"
POST /projects/:id/repository/commit
s"
do
let!
(
:url
)
{
"/projects/
#{
project
.
id
}
/repository/commits"
}
it
'returns a 403 unauthorized for user without permissions'
do
...
...
@@ -103,7 +103,7 @@ describe API::V3::Commits, api: true do
expect
(
response
).
to
have_http_status
(
400
)
end
context
:create
do
describe
'create'
do
let
(
:message
)
{
'Created file'
}
let!
(
:invalid_c_params
)
do
{
...
...
@@ -147,8 +147,9 @@ describe API::V3::Commits, api: true do
expect
(
response
).
to
have_http_status
(
400
)
end
context
'with project path in URL'
do
let
(
:url
)
{
"/projects/
#{
project
.
full_path
.
gsub
(
'/'
,
'%2F'
)
}
/repository/commits"
}
context
'with project path containing a dot in URL'
do
let!
(
:user
)
{
create
(
:user
,
username:
'foo.bar'
)
}
let
(
:url
)
{
"/projects/
#{
CGI
.
escape
(
project
.
full_path
)
}
/repository/commits"
}
it
'a new file in project repo'
do
post
v3_api
(
url
,
user
),
valid_c_params
...
...
@@ -158,7 +159,7 @@ describe API::V3::Commits, api: true do
end
end
context
:delete
do
describe
'delete'
do
let
(
:message
)
{
'Deleted file'
}
let!
(
:invalid_d_params
)
do
{
...
...
@@ -199,7 +200,7 @@ describe API::V3::Commits, api: true do
end
end
context
:move
do
describe
'move'
do
let
(
:message
)
{
'Moved file'
}
let!
(
:invalid_m_params
)
do
{
...
...
@@ -244,7 +245,7 @@ describe API::V3::Commits, api: true do
end
end
context
:update
do
describe
'update'
do
let
(
:message
)
{
'Updated file'
}
let!
(
:invalid_u_params
)
do
{
...
...
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