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
4a562fdb
Commit
4a562fdb
authored
Sep 18, 2019
by
Matija Čupić
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Put ArtifactsController#index behind feature flag
parent
97e085fa
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
11 deletions
+47
-11
app/controllers/projects/artifacts_controller.rb
app/controllers/projects/artifacts_controller.rb
+6
-0
spec/controllers/projects/artifacts_controller_spec.rb
spec/controllers/projects/artifacts_controller_spec.rb
+41
-11
No files found.
app/controllers/projects/artifacts_controller.rb
View file @
4a562fdb
...
...
@@ -16,6 +16,12 @@ class Projects::ArtifactsController < Projects::ApplicationController
MAX_PER_PAGE
=
20
def
index
# Loading artifacts is very expensive in projects with a lot of artifacts.
# This feature flag prevents a DOS attack vector.
# It should be removed only after resolving the underlying performance
# issues: https://gitlab.com/gitlab-org/gitlab/issues/32281
return
head
:no_content
unless
Feature
.
enabled?
(
:artifacts_management_page
,
@project
)
finder
=
ArtifactsFinder
.
new
(
@project
,
artifacts_params
)
all_artifacts
=
finder
.
execute
...
...
spec/controllers/projects/artifacts_controller_spec.rb
View file @
4a562fdb
...
...
@@ -23,6 +23,11 @@ describe Projects::ArtifactsController do
describe
'GET index'
do
subject
{
get
:index
,
params:
{
namespace_id:
project
.
namespace
,
project_id:
project
}
}
context
'when feature flag is on'
do
before
do
stub_feature_flags
(
artifacts_management_page:
true
)
end
it
'sets the artifacts variable'
do
subject
...
...
@@ -48,6 +53,31 @@ describe Projects::ArtifactsController do
end
end
context
'when feature flag is off'
do
before
do
stub_feature_flags
(
artifacts_management_page:
false
)
end
it
'renders no content'
do
subject
expect
(
response
).
to
have_gitlab_http_status
(
:no_content
)
end
it
'does not set the artifacts variable'
do
subject
expect
(
assigns
(
:artifacts
)).
to
eq
(
nil
)
end
it
'does not set the total size variable'
do
subject
expect
(
assigns
(
:total_size
)).
to
eq
(
nil
)
end
end
end
describe
'DELETE destroy'
do
let!
(
:artifact
)
{
job
.
job_artifacts
.
erasable
.
first
}
...
...
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