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
83bd3f7b
Commit
83bd3f7b
authored
Nov 11, 2019
by
Paul Slaughter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Merge branch '35120-links-dependency-files-fix' into 'master'"
This reverts merge request !19464
parent
98f43158
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
23 deletions
+6
-23
app/assets/javascripts/blob/blob_utils.js
app/assets/javascripts/blob/blob_utils.js
+2
-2
spec/javascripts/blob/viewer/index_spec.js
spec/javascripts/blob/viewer/index_spec.js
+4
-21
No files found.
app/assets/javascripts/blob/blob_utils.js
View file @
83bd3f7b
// capture anything starting with http:// or https://
which is not already part of a html link
// capture anything starting with http:// or https://
// up until a disallowed character or whitespace
export
const
blobLinkRegex
=
/
(?<
!<a href="
)
https
?
:
\/\/[^
"<>
\\
^`{|}
\s]
+/g
;
export
const
blobLinkRegex
=
/https
?
:
\/\/[^
"<>
\\
^`{|}
\s]
+/g
;
export
default
{
blobLinkRegex
};
spec/javascripts/blob/viewer/index_spec.js
View file @
83bd3f7b
...
...
@@ -176,36 +176,19 @@ describe('Blob viewer', () => {
});
});
describe
(
'
linkifyURLs
'
,
()
=>
{
it
(
'
renders a plain url as a link in simple view
'
,
done
=>
{
describe
(
'
a URL inside the blob content
'
,
()
=>
{
beforeEach
(()
=>
{
mock
.
onGet
(
'
http://test.host/snippets/1.json?viewer=simple
'
).
reply
(
200
,
{
html
:
'
<div class="js-blob-content"><pre class="code"><code><span class="line" lang="yaml"><span class="c1">To install gitlab-shell you also need a Go compiler version 1.8 or newer. https://golang.org/dl/</span></span></code></pre></div>
'
,
});
asyncClick
()
.
then
(()
=>
{
expect
(
document
.
querySelector
(
'
.blob-viewer[data-type="simple"]
'
).
innerHTML
).
toContain
(
'
<a href="https://golang.org/dl/">https://golang.org/dl/</a>
'
,
);
done
();
})
.
catch
(()
=>
{
fail
();
done
();
});
});
it
(
'
leaves an unescaped url untouched
'
,
done
=>
{
mock
.
onGet
(
'
http://test.host/snippets/1.json?viewer=simple
'
).
reply
(
200
,
{
html
:
'
<div class="js-blob-content"><pre class="code"><code><span class="line" lang="yaml"><a href="https://golang.org/dl/">golang</a></span></span></code></pre></div>
'
,
});
it
(
'
is rendered as a link in simple view
'
,
done
=>
{
asyncClick
()
.
then
(()
=>
{
expect
(
document
.
querySelector
(
'
.blob-viewer[data-type="simple"]
'
).
innerHTML
).
toContain
(
'
<a href="https://golang.org/dl/">
golang
</a>
'
,
'
<a href="https://golang.org/dl/">
https://golang.org/dl/
</a>
'
,
);
done
();
})
...
...
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