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
iv
gitlab-ce
Commits
a5e1905d
Commit
a5e1905d
authored
Jan 04, 2016
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Render 404 when artifacts path is invalid
parent
f948c007
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
3 deletions
+6
-3
app/controllers/projects/artifacts_controller.rb
app/controllers/projects/artifacts_controller.rb
+1
-0
lib/gitlab/ci/build/artifacts/metadata.rb
lib/gitlab/ci/build/artifacts/metadata.rb
+1
-1
spec/lib/gitlab/ci/build/artifacts/metadata_spec.rb
spec/lib/gitlab/ci/build/artifacts/metadata_spec.rb
+4
-2
No files found.
app/controllers/projects/artifacts_controller.rb
View file @
a5e1905d
...
@@ -17,6 +17,7 @@ class Projects::ArtifactsController < Projects::ApplicationController
...
@@ -17,6 +17,7 @@ class Projects::ArtifactsController < Projects::ApplicationController
def
browse
def
browse
return
render_404
unless
build
.
artifacts?
return
render_404
unless
build
.
artifacts?
@path
=
build
.
artifacts_metadata_string_path
(
params
[
:path
]
||
'./'
)
@path
=
build
.
artifacts_metadata_string_path
(
params
[
:path
]
||
'./'
)
return
render_404
if
@path
.
universe
.
empty?
end
end
private
private
...
...
lib/gitlab/ci/build/artifacts/metadata.rb
View file @
a5e1905d
...
@@ -22,7 +22,7 @@ module Gitlab
...
@@ -22,7 +22,7 @@ module Gitlab
paths
,
metadata
=
[],
[]
paths
,
metadata
=
[],
[]
each
do
|
line
|
each
do
|
line
|
next
unless
line
=~
%r{^
#{
Regexp
.
escape
(
@path
)
}
[^/
\s
]
+
/?
\s
}
next
unless
line
=~
%r{^
#{
Regexp
.
escape
(
@path
)
}
[^/
\s
]
*
/?
\s
}
path
,
meta
=
line
.
split
(
' '
)
path
,
meta
=
line
.
split
(
' '
)
paths
.
push
(
path
)
paths
.
push
(
path
)
...
...
spec/lib/gitlab/ci/build/artifacts/metadata_spec.rb
View file @
a5e1905d
...
@@ -38,7 +38,8 @@ describe Gitlab::Ci::Build::Artifacts::Metadata do
...
@@ -38,7 +38,8 @@ describe Gitlab::Ci::Build::Artifacts::Metadata do
it
'matches correct paths'
do
it
'matches correct paths'
do
expect
(
subject
.
first
).
expect
(
subject
.
first
).
to
contain_exactly
'other_artifacts_0.1.2/doc_sample.txt'
,
to
contain_exactly
'other_artifacts_0.1.2/'
,
'other_artifacts_0.1.2/doc_sample.txt'
,
'other_artifacts_0.1.2/another-subdirectory/'
'other_artifacts_0.1.2/another-subdirectory/'
end
end
end
end
...
@@ -48,7 +49,8 @@ describe Gitlab::Ci::Build::Artifacts::Metadata do
...
@@ -48,7 +49,8 @@ describe Gitlab::Ci::Build::Artifacts::Metadata do
it
'matches correct paths'
do
it
'matches correct paths'
do
expect
(
subject
.
first
).
expect
(
subject
.
first
).
to
contain_exactly
'other_artifacts_0.1.2/another-subdirectory/empty_directory/'
,
to
contain_exactly
'other_artifacts_0.1.2/another-subdirectory/'
,
'other_artifacts_0.1.2/another-subdirectory/empty_directory/'
,
'other_artifacts_0.1.2/another-subdirectory/banana_sample.gif'
'other_artifacts_0.1.2/another-subdirectory/banana_sample.gif'
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