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
Jérome Perrin
gitlab-ce
Commits
d5486807
Commit
d5486807
authored
Oct 04, 2017
by
Zeger-Jan van de Weg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Incorporate feedback
parent
8640b294
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
38 additions
and
13 deletions
+38
-13
app/views/projects/artifacts/_tree_file.html.haml
app/views/projects/artifacts/_tree_file.html.haml
+3
-2
config/initializers/1_settings.rb
config/initializers/1_settings.rb
+1
-1
spec/controllers/projects/artifacts_controller_spec.rb
spec/controllers/projects/artifacts_controller_spec.rb
+33
-9
spec/models/ci/artifact_blob_spec.rb
spec/models/ci/artifact_blob_spec.rb
+1
-1
No files found.
app/views/projects/artifacts/_tree_file.html.haml
View file @
d5486807
-
blob
=
file
.
blob
-
blob
=
file
.
blob
-
path_to_file
=
file_project_job_artifacts_path
(
@project
,
@build
,
path:
file
.
path
)
-
path_to_file
=
file_project_job_artifacts_path
(
@project
,
@build
,
path:
file
.
path
)
-
external_link
=
blob
.
external_link?
&&
@project
.
public?
%tr
.tree-item.js-artifact-tree-row
{
data:
{
link:
path_to_file
,
external_link:
"#{
blob.external_link?
}"
}
}
%tr
.tree-item.js-artifact-tree-row
{
data:
{
link:
path_to_file
,
external_link:
"#{
external_link
}"
}
}
%td
.tree-item-file-name
%td
.tree-item-file-name
=
tree_icon
(
'file'
,
blob
.
mode
,
blob
.
name
)
=
tree_icon
(
'file'
,
blob
.
mode
,
blob
.
name
)
-
if
blob
.
external_link?
-
if
external_link
=
link_to
path_to_file
,
class:
'tree-item-file-external-link js-artifact-tree-tooltip'
,
=
link_to
path_to_file
,
class:
'tree-item-file-external-link js-artifact-tree-tooltip'
,
target:
'_blank'
,
rel:
'noopener noreferrer'
,
title:
_
(
'Opens in a new window'
)
do
target:
'_blank'
,
rel:
'noopener noreferrer'
,
title:
_
(
'Opens in a new window'
)
do
%span
.str-truncated
>=
blob
.
name
%span
.str-truncated
>=
blob
.
name
...
...
config/initializers/1_settings.rb
View file @
d5486807
...
@@ -325,7 +325,7 @@ Settings.pages['protocol'] ||= Settings.pages.https ? "https" : "http"
...
@@ -325,7 +325,7 @@ Settings.pages['protocol'] ||= Settings.pages.https ? "https" : "http"
Settings
.
pages
[
'url'
]
||=
Settings
.
__send__
(
:build_pages_url
)
Settings
.
pages
[
'url'
]
||=
Settings
.
__send__
(
:build_pages_url
)
Settings
.
pages
[
'external_http'
]
||=
false
unless
Settings
.
pages
[
'external_http'
].
present?
Settings
.
pages
[
'external_http'
]
||=
false
unless
Settings
.
pages
[
'external_http'
].
present?
Settings
.
pages
[
'external_https'
]
||=
false
unless
Settings
.
pages
[
'external_https'
].
present?
Settings
.
pages
[
'external_https'
]
||=
false
unless
Settings
.
pages
[
'external_https'
].
present?
Settings
.
pages
[
'artifacts_server'
]
||=
Settings
.
pages
[
'enabled'
]
Settings
.
pages
[
'artifacts_server'
]
||=
Settings
.
pages
[
'enabled'
]
if
Settings
.
pages
[
'artifacts_server'
].
nil?
#
#
# Git LFS
# Git LFS
...
...
spec/controllers/projects/artifacts_controller_spec.rb
View file @
d5486807
...
@@ -49,22 +49,46 @@ describe Projects::ArtifactsController do
...
@@ -49,22 +49,46 @@ describe Projects::ArtifactsController do
describe
'GET file'
do
describe
'GET file'
do
before
do
before
do
allow
(
Gitlab
.
config
.
pages
).
to
receive
(
:enabled
).
and_return
(
true
)
allow
(
Gitlab
.
config
.
pages
).
to
receive
(
:enabled
).
and_return
(
true
)
allow
(
Gitlab
.
config
.
pages
).
to
receive
(
:artifacts_server
).
and_return
(
true
)
end
end
context
'when the file exists'
do
context
'when the file is served by GitLab Pages'
do
it
'renders the file view'
do
before
do
get
:file
,
namespace_id:
project
.
namespace
,
project_id:
project
,
job_id:
job
,
path:
'ci_artifacts.txt'
allow
(
Gitlab
.
config
.
pages
).
to
receive
(
:artifacts_server
).
and_return
(
true
)
end
context
'when the file exists'
do
it
'renders the file view'
do
get
:file
,
namespace_id:
project
.
namespace
,
project_id:
project
,
job_id:
job
,
path:
'ci_artifacts.txt'
expect
(
response
).
to
have_http_status
(
302
)
end
end
expect
(
response
).
to
have_http_status
(
302
)
context
'when the file does not exist'
do
it
'responds Not Found'
do
get
:file
,
namespace_id:
project
.
namespace
,
project_id:
project
,
job_id:
job
,
path:
'unknown'
expect
(
response
).
to
be_not_found
end
end
end
end
end
context
'when the file does not exist'
do
context
'when the file is served through Rails'
do
it
'responds Not Found'
do
context
'when the file exists'
do
get
:file
,
namespace_id:
project
.
namespace
,
project_id:
project
,
job_id:
job
,
path:
'unknown'
it
'renders the file view'
do
get
:file
,
namespace_id:
project
.
namespace
,
project_id:
project
,
job_id:
job
,
path:
'ci_artifacts.txt'
expect
(
response
).
to
be_not_found
expect
(
response
).
to
have_http_status
(
:ok
)
expect
(
response
).
to
render_template
(
'projects/artifacts/file'
)
end
end
context
'when the file does not exist'
do
it
'responds Not Found'
do
get
:file
,
namespace_id:
project
.
namespace
,
project_id:
project
,
job_id:
job
,
path:
'unknown'
expect
(
response
).
to
be_not_found
end
end
end
end
end
end
end
...
...
spec/models/ci/artifact_blob_spec.rb
View file @
d5486807
...
@@ -42,7 +42,7 @@ describe Ci::ArtifactBlob do
...
@@ -42,7 +42,7 @@ describe Ci::ArtifactBlob do
end
end
end
end
describe
'#url'
do
describe
'#
external_
url'
do
before
do
before
do
allow
(
Gitlab
.
config
.
pages
).
to
receive
(
:enabled
).
and_return
(
true
)
allow
(
Gitlab
.
config
.
pages
).
to
receive
(
:enabled
).
and_return
(
true
)
allow
(
Gitlab
.
config
.
pages
).
to
receive
(
:artifacts_server
).
and_return
(
true
)
allow
(
Gitlab
.
config
.
pages
).
to
receive
(
:artifacts_server
).
and_return
(
true
)
...
...
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