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
110f5a16
Commit
110f5a16
authored
May 18, 2017
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Catch all URI errors in ExternalLinkFilter
parent
b46b52af
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
1 deletion
+12
-1
changelogs/unreleased/dm-catch-uri-errors.yml
changelogs/unreleased/dm-catch-uri-errors.yml
+4
-0
lib/banzai/filter/external_link_filter.rb
lib/banzai/filter/external_link_filter.rb
+1
-1
spec/lib/banzai/filter/external_link_filter_spec.rb
spec/lib/banzai/filter/external_link_filter_spec.rb
+7
-0
No files found.
changelogs/unreleased/dm-catch-uri-errors.yml
0 → 100644
View file @
110f5a16
---
title
:
Catch all URI errors in ExternalLinkFilter
merge_request
:
author
:
lib/banzai/filter/external_link_filter.rb
View file @
110f5a16
...
@@ -24,7 +24,7 @@ module Banzai
...
@@ -24,7 +24,7 @@ module Banzai
def
uri
(
href
)
def
uri
(
href
)
URI
.
parse
(
href
)
URI
.
parse
(
href
)
rescue
URI
::
InvalidURI
Error
rescue
URI
::
Error
nil
nil
end
end
...
...
spec/lib/banzai/filter/external_link_filter_spec.rb
View file @
110f5a16
...
@@ -55,6 +55,13 @@ describe Banzai::Filter::ExternalLinkFilter, lib: true do
...
@@ -55,6 +55,13 @@ describe Banzai::Filter::ExternalLinkFilter, lib: true do
expect
(
doc
.
to_html
).
to
eq
(
expected
)
expect
(
doc
.
to_html
).
to
eq
(
expected
)
end
end
it
'skips improperly formatted mailtos'
do
doc
=
filter
%q(<p><a href="mailto://jblogs@example.com">Email</a></p>)
expected
=
%q(<p><a href="mailto://jblogs@example.com">Email</a></p>)
expect
(
doc
.
to_html
).
to
eq
(
expected
)
end
end
end
context
'for links with a username'
do
context
'for links with a username'
do
...
...
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