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
e132aa6d
Commit
e132aa6d
authored
Apr 06, 2020
by
Francisco Javier López
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update copy when snippet git feature disabled
parent
94c735f6
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
15 additions
and
10 deletions
+15
-10
app/controllers/repositories/git_http_controller.rb
app/controllers/repositories/git_http_controller.rb
+1
-1
changelogs/unreleased/fj-replace-snippet-git-message.yml
changelogs/unreleased/fj-replace-snippet-git-message.yml
+5
-0
lib/api/internal/base.rb
lib/api/internal/base.rb
+1
-1
spec/controllers/repositories/git_http_controller_spec.rb
spec/controllers/repositories/git_http_controller_spec.rb
+6
-6
spec/requests/api/internal/base_spec.rb
spec/requests/api/internal/base_spec.rb
+2
-2
No files found.
app/controllers/repositories/git_http_controller.rb
View file @
e132aa6d
...
...
@@ -121,7 +121,7 @@ module Repositories
def
snippet_request_allowed?
if
repo_type
.
snippet?
&&
Feature
.
disabled?
(
:version_snippets
,
user
)
Gitlab
::
AppLogger
.
info
(
'Snippet access attempt with feature disabled'
)
render
plain:
'
The project you were looking for could not be found.'
,
status: :not_found
render
plain:
'
Snippet git access is disabled.'
,
status: :forbidden
end
end
end
...
...
changelogs/unreleased/fj-replace-snippet-git-message.yml
0 → 100644
View file @
e132aa6d
---
title
:
Update copy when snippet git feature disabled
merge_request
:
28913
author
:
type
:
changed
lib/api/internal/base.rb
View file @
e132aa6d
...
...
@@ -109,7 +109,7 @@ module API
# group resources based on its IP restrictions
post
"/allowed"
do
if
repo_type
.
snippet?
&&
Feature
.
disabled?
(
:version_snippets
,
actor
.
user
)
break
response_with_status
(
code:
40
4
,
success:
false
,
message:
'The project you were looking for could not be foun
d.'
)
break
response_with_status
(
code:
40
1
,
success:
false
,
message:
'Snippet git access is disable
d.'
)
end
# It was moved to a separate method so that EE can alter its behaviour more
...
...
spec/controllers/repositories/git_http_controller_spec.rb
View file @
e132aa6d
...
...
@@ -145,13 +145,13 @@ describe Repositories::GitHttpController do
describe
'GET #info_refs'
do
let
(
:params
)
{
container_params
.
merge
(
service:
'git-upload-pack'
)
}
it
'returns 40
4
'
do
it
'returns 40
3
'
do
expect
(
controller
).
not_to
receive
(
:access_check
)
get
:info_refs
,
params:
params
expect
(
response
).
to
have_gitlab_http_status
(
:
not_found
)
expect
(
response
.
body
).
to
eq
"The project you were looking for could not be found."
expect
(
response
).
to
have_gitlab_http_status
(
:
forbidden
)
expect
(
response
.
body
).
to
eq
'Snippet git access is disabled.'
end
end
...
...
@@ -162,13 +162,13 @@ describe Repositories::GitHttpController do
allow
(
controller
).
to
receive
(
:access_check
).
and_return
(
nil
)
end
it
'returns 40
4
'
do
it
'returns 40
3
'
do
expect
(
controller
).
not_to
receive
(
:access_check
)
post
:git_upload_pack
,
params:
params
expect
(
response
).
to
have_gitlab_http_status
(
:
not_found
)
expect
(
response
.
body
).
to
eq
"The project you were looking for could not be found."
expect
(
response
).
to
have_gitlab_http_status
(
:
forbidden
)
expect
(
response
.
body
).
to
eq
'Snippet git access is disabled.'
end
end
end
...
...
spec/requests/api/internal/base_spec.rb
View file @
e132aa6d
...
...
@@ -325,12 +325,12 @@ describe API::Internal::Base do
shared_examples
'snippets with disabled feature flag'
do
context
'when feature flag :version_snippets is disabled'
do
it
'returns 40
4
'
do
it
'returns 40
1
'
do
stub_feature_flags
(
version_snippets:
false
)
subject
expect
(
response
).
to
have_gitlab_http_status
(
:
not_foun
d
)
expect
(
response
).
to
have_gitlab_http_status
(
:
unauthorize
d
)
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