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
ef3eb2d9
Commit
ef3eb2d9
authored
7 years ago
by
Nick Thomas
Committed by
Winnie Hellmann
7 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix the external URLs generated for online view of HTML artifacts
parent
5e93320e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
10 deletions
+19
-10
app/models/ci/artifact_blob.rb
app/models/ci/artifact_blob.rb
+11
-6
changelogs/unreleased/39189-online-view-of-html-artifacts-is-broken.yml
...eleased/39189-online-view-of-html-artifacts-is-broken.yml
+5
-0
spec/models/ci/artifact_blob_spec.rb
spec/models/ci/artifact_blob_spec.rb
+3
-4
No files found.
app/models/ci/artifact_blob.rb
View file @
ef3eb2d9
...
@@ -2,7 +2,7 @@ module Ci
...
@@ -2,7 +2,7 @@ module Ci
class
ArtifactBlob
class
ArtifactBlob
include
BlobLike
include
BlobLike
EXTEN
T
IONS_SERVED_BY_PAGES
=
%w[.html .htm .txt .json]
.
freeze
EXTEN
S
IONS_SERVED_BY_PAGES
=
%w[.html .htm .txt .json]
.
freeze
attr_reader
:entry
attr_reader
:entry
...
@@ -36,17 +36,22 @@ module Ci
...
@@ -36,17 +36,22 @@ module Ci
def
external_url
(
project
,
job
)
def
external_url
(
project
,
job
)
return
unless
external_link?
(
job
)
return
unless
external_link?
(
job
)
components
=
project
.
full_path_components
full_path_parts
=
project
.
full_path_components
components
<<
"-/jobs/
#{
job
.
id
}
/artifacts/file/
#{
path
}
"
top_level_group
=
full_path_parts
.
shift
artifact_path
=
components
[
1
..-
1
].
join
(
'/'
)
"
#{
pages_config
.
protocol
}
://
#{
components
[
0
]
}
.
#{
pages_config
.
host
}
/
#{
artifact_path
}
"
artifact_path
=
[
'-'
,
*
full_path_parts
,
'-'
,
'jobs'
,
job
.
id
,
'artifacts'
,
path
].
join
(
'/'
)
"
#{
pages_config
.
protocol
}
://
#{
top_level_group
}
.
#{
pages_config
.
host
}
/
#{
artifact_path
}
"
end
end
def
external_link?
(
job
)
def
external_link?
(
job
)
pages_config
.
enabled
&&
pages_config
.
enabled
&&
pages_config
.
artifacts_server
&&
pages_config
.
artifacts_server
&&
EXTEN
T
IONS_SERVED_BY_PAGES
.
include?
(
File
.
extname
(
name
))
&&
EXTEN
S
IONS_SERVED_BY_PAGES
.
include?
(
File
.
extname
(
name
))
&&
job
.
project
.
public?
job
.
project
.
public?
end
end
...
...
This diff is collapsed.
Click to expand it.
changelogs/unreleased/39189-online-view-of-html-artifacts-is-broken.yml
0 → 100644
View file @
ef3eb2d9
---
title
:
Fix the external URLs generated for online view of HTML artifacts
merge_request
:
14977
author
:
type
:
fixed
This diff is collapsed.
Click to expand it.
spec/models/ci/artifact_blob_spec.rb
View file @
ef3eb2d9
...
@@ -56,15 +56,14 @@ describe Ci::ArtifactBlob do
...
@@ -56,15 +56,14 @@ describe Ci::ArtifactBlob do
end
end
context
'txt extensions'
do
context
'txt extensions'
do
let
(
:entry
)
{
build
.
artifacts_metadata_entry
(
'other_artifacts_0.1.2/doc_sample.txt'
)
}
let
(
:path
)
{
'other_artifacts_0.1.2/doc_sample.txt'
}
let
(
:entry
)
{
build
.
artifacts_metadata_entry
(
path
)
}
it
'returns a URL'
do
it
'returns a URL'
do
url
=
subject
.
external_url
(
build
.
project
,
build
)
url
=
subject
.
external_url
(
build
.
project
,
build
)
expect
(
url
).
not_to
be_nil
expect
(
url
).
not_to
be_nil
expect
(
url
).
to
start_with
(
"http"
)
expect
(
url
).
to
eq
(
"http://
#{
project
.
namespace
.
path
}
.
#{
Gitlab
.
config
.
pages
.
host
}
/-/
#{
project
.
path
}
/-/jobs/
#{
build
.
id
}
/artifacts/
#{
path
}
"
)
expect
(
url
).
to
match
Gitlab
.
config
.
pages
.
host
expect
(
url
).
to
end_with
(
entry
.
path
)
end
end
end
end
end
end
...
...
This diff is collapsed.
Click to expand it.
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