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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
54ab9bb6
Commit
54ab9bb6
authored
Feb 13, 2013
by
Sebastian Ziebell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
API: return status code 400 if filepath of raw file blob not given
parent
fd01f3aa
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
1 deletion
+8
-1
lib/api/projects.rb
lib/api/projects.rb
+2
-0
spec/requests/api/projects_spec.rb
spec/requests/api/projects_spec.rb
+6
-1
No files found.
lib/api/projects.rb
View file @
54ab9bb6
...
@@ -451,6 +451,8 @@ module Gitlab
...
@@ -451,6 +451,8 @@ module Gitlab
get
":id/repository/commits/:sha/blob"
do
get
":id/repository/commits/:sha/blob"
do
authorize!
:download_code
,
user_project
authorize!
:download_code
,
user_project
error!
(
"Filepath must be specified"
,
400
)
if
!
params
.
has_key?
:filepath
ref
=
params
[
:sha
]
ref
=
params
[
:sha
]
commit
=
user_project
.
repository
.
commit
ref
commit
=
user_project
.
repository
.
commit
ref
...
...
spec/requests/api/projects_spec.rb
View file @
54ab9bb6
...
@@ -468,7 +468,7 @@ describe Gitlab::API do
...
@@ -468,7 +468,7 @@ describe Gitlab::API do
end
end
end
end
describe
"GET /projects/:id/:sha/blob"
do
describe
"GET /projects/:id/
repository/commits/
:sha/blob"
do
it
"should get the raw file contents"
do
it
"should get the raw file contents"
do
get
api
(
"/projects/
#{
project
.
id
}
/repository/commits/master/blob?filepath=README.md"
,
user
)
get
api
(
"/projects/
#{
project
.
id
}
/repository/commits/master/blob?filepath=README.md"
,
user
)
response
.
status
.
should
==
200
response
.
status
.
should
==
200
...
@@ -483,5 +483,10 @@ describe Gitlab::API do
...
@@ -483,5 +483,10 @@ describe Gitlab::API do
get
api
(
"/projects/
#{
project
.
id
}
/repository/commits/master/blob?filepath=README.invalid"
,
user
)
get
api
(
"/projects/
#{
project
.
id
}
/repository/commits/master/blob?filepath=README.invalid"
,
user
)
response
.
status
.
should
==
404
response
.
status
.
should
==
404
end
end
it
"should return a 400 error if filepath is missing"
do
get
api
(
"/projects/
#{
project
.
id
}
/repository/commits/master/blob"
,
user
)
response
.
status
.
should
==
400
end
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