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
45dcb57d
Commit
45dcb57d
authored
Jul 13, 2021
by
Claas Augner
Committed by
Jose Ivan Vargas
Jul 13, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Exclude brackets from job log links
parent
6a2abbf0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
3 deletions
+33
-3
app/assets/javascripts/jobs/utils.js
app/assets/javascripts/jobs/utils.js
+3
-3
spec/frontend/jobs/components/log/line_spec.js
spec/frontend/jobs/components/log/line_spec.js
+30
-0
No files found.
app/assets/javascripts/jobs/utils.js
View file @
45dcb57d
...
...
@@ -3,10 +3,10 @@
* https?:\/\/
*
* up until a disallowed character or whitespace
* [^"<>\\^`{|}\s]+
* [^"<>
()
\\^`{|}\s]+
*
* and a disallowed character or whitespace, including non-ending chars .,:;!?
* [^"<>\\^`{|}\s.,:;!?]
* [^"<>
()
\\^`{|}\s.,:;!?]
*/
export
const
linkRegex
=
/
(
https
?
:
\/\/[^
"<>
\\
^`{|}
\s]
+
[^
"<>
\\
^`{|}
\s
.,:;!?
])
/g
;
export
const
linkRegex
=
/
(
https
?
:
\/\/[^
"<>
()
\\
^`{|}
\s]
+
[^
"<>()
\\
^`{|}
\s
.,:;!?
])
/g
;
export
default
{
linkRegex
};
spec/frontend/jobs/components/log/line_spec.js
View file @
45dcb57d
...
...
@@ -94,6 +94,16 @@ describe('Job Log Line', () => {
expect
(
findLinkAttributeByIndex
(
0
).
href
).
toBe
(
queryUrl
);
});
it
(
'
renders links that have brackets `[]` in their parameters
'
,
()
=>
{
const
url
=
`
${
httpUrl
}
?label_name[]=frontend`
;
createComponent
(
mockProps
({
text
:
url
}));
expect
(
findLine
().
text
()).
toBe
(
url
);
expect
(
findLinks
().
at
(
0
).
text
()).
toBe
(
url
);
expect
(
findLinks
().
at
(
0
).
attributes
(
'
href
'
)).
toBe
(
url
);
});
it
(
'
renders multiple links surrounded by text
'
,
()
=>
{
createComponent
(
mockProps
({
text
:
`Well, my HTTP url:
${
httpUrl
}
and my HTTPS url:
${
httpsUrl
}
`
}),
...
...
@@ -125,6 +135,26 @@ describe('Job Log Line', () => {
expect
(
findLinkAttributeByIndex
(
4
).
href
).
toBe
(
httpsUrl
);
});
it
(
'
renders multiple links surrounded by brackets
'
,
()
=>
{
createComponent
(
mockProps
({
text
:
`(
${
httpUrl
}
) <
${
httpUrl
}
> {
${
httpsUrl
}
}`
}));
expect
(
findLine
().
text
()).
toBe
(
'
(http://example.com) <http://example.com> {https://example.com}
'
,
);
const
links
=
findLinks
();
expect
(
links
).
toHaveLength
(
3
);
expect
(
links
.
at
(
0
).
text
()).
toBe
(
httpUrl
);
expect
(
links
.
at
(
0
).
attributes
(
'
href
'
)).
toBe
(
httpUrl
);
expect
(
links
.
at
(
1
).
text
()).
toBe
(
httpUrl
);
expect
(
links
.
at
(
1
).
attributes
(
'
href
'
)).
toBe
(
httpUrl
);
expect
(
links
.
at
(
2
).
text
()).
toBe
(
httpsUrl
);
expect
(
links
.
at
(
2
).
attributes
(
'
href
'
)).
toBe
(
httpsUrl
);
});
it
(
'
renders text with symbols in it
'
,
()
=>
{
const
text
=
'
apt-get update < /dev/null > /dev/null
'
;
createComponent
(
mockProps
({
text
}));
...
...
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