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
232b4014
Commit
232b4014
authored
Jan 24, 2017
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix access to the wiki code via HTTP when repository feature disabled
parent
b55c1bc4
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
6 deletions
+34
-6
app/controllers/projects/git_http_client_controller.rb
app/controllers/projects/git_http_client_controller.rb
+7
-5
app/controllers/projects/git_http_controller.rb
app/controllers/projects/git_http_controller.rb
+5
-1
spec/requests/git_http_spec.rb
spec/requests/git_http_spec.rb
+22
-0
No files found.
app/controllers/projects/git_http_client_controller.rb
View file @
232b4014
...
@@ -109,12 +109,14 @@ class Projects::GitHttpClientController < Projects::ApplicationController
...
@@ -109,12 +109,14 @@ class Projects::GitHttpClientController < Projects::ApplicationController
end
end
def
repository
def
repository
_
,
suffix
=
project_id_with_suffix
wiki?
?
project
.
wiki
.
repository
:
project
.
repository
if
suffix
==
'.wiki.git'
project
.
wiki
.
repository
else
project
.
repository
end
end
def
wiki?
return
@wiki
if
defined?
(
@wiki
)
_
,
suffix
=
project_id_with_suffix
@wiki
=
suffix
==
'.wiki.git'
end
end
def
render_not_found
def
render_not_found
...
...
app/controllers/projects/git_http_controller.rb
View file @
232b4014
...
@@ -84,7 +84,7 @@ class Projects::GitHttpController < Projects::GitHttpClientController
...
@@ -84,7 +84,7 @@ class Projects::GitHttpController < Projects::GitHttpClientController
end
end
def
access
def
access
@access
||=
Gitlab
::
GitAcce
ss
.
new
(
user
,
project
,
'http'
,
authentication_abilities:
authentication_abilities
)
@access
||=
access_kla
ss
.
new
(
user
,
project
,
'http'
,
authentication_abilities:
authentication_abilities
)
end
end
def
access_check
def
access_check
...
@@ -102,4 +102,8 @@ class Projects::GitHttpController < Projects::GitHttpClientController
...
@@ -102,4 +102,8 @@ class Projects::GitHttpController < Projects::GitHttpClientController
access_check
.
allowed?
access_check
.
allowed?
end
end
def
access_klass
@access_klass
||=
wiki?
?
Gitlab
::
GitAccessWiki
:
Gitlab
::
GitAccess
end
end
end
spec/requests/git_http_spec.rb
View file @
232b4014
...
@@ -55,6 +55,28 @@ describe 'Git HTTP requests', lib: true do
...
@@ -55,6 +55,28 @@ describe 'Git HTTP requests', lib: true do
expect
(
response
.
content_type
.
to_s
).
to
eq
(
Gitlab
::
Workhorse
::
INTERNAL_API_CONTENT_TYPE
)
expect
(
response
.
content_type
.
to_s
).
to
eq
(
Gitlab
::
Workhorse
::
INTERNAL_API_CONTENT_TYPE
)
end
end
end
end
context
'but the repo is disabled'
do
let
(
:project
)
{
create
(
:project
,
repository_access_level:
ProjectFeature
::
DISABLED
,
wiki_access_level:
ProjectFeature
::
ENABLED
)
}
let
(
:wiki
)
{
ProjectWiki
.
new
(
project
)
}
let
(
:path
)
{
"/
#{
wiki
.
repository
.
path_with_namespace
}
.git"
}
before
do
project
.
team
<<
[
user
,
:developer
]
end
it
'allows clones'
do
download
(
path
,
user:
user
.
username
,
password:
user
.
password
)
do
|
response
|
expect
(
response
).
to
have_http_status
(
200
)
end
end
it
'allows pushes'
do
upload
(
path
,
user:
user
.
username
,
password:
user
.
password
)
do
|
response
|
expect
(
response
).
to
have_http_status
(
200
)
end
end
end
end
end
context
"when the project exists"
do
context
"when the project exists"
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