File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -54,6 +54,7 @@ export function init({ groups }) {
54
54
tk . COMMA ,
55
55
tk . DOT ,
56
56
tk . EXCLAMATION ,
57
+ tk . PERCENT ,
57
58
tk . QUERY ,
58
59
tk . QUOTE ,
59
60
tk . SEMI ,
@@ -211,6 +212,7 @@ export function init({ groups }) {
211
212
// Force URL with scheme prefix followed by anything sane
212
213
ta ( SchemeColon , groups . domain , Url ) ;
213
214
tt ( SchemeColon , tk . SLASH , Url ) ;
215
+ tt ( SchemeColon , tk . QUERY , Url ) ;
214
216
ta ( UriPrefix , groups . domain , Url ) ;
215
217
ta ( UriPrefix , qsAccepting , Url ) ;
216
218
tt ( UriPrefix , tk . SLASH , Url ) ;
Original file line number Diff line number Diff line change @@ -37,8 +37,9 @@ describe('linkifyjs', () => {
37
37
38
38
describe ( 'registerCustomProtocol' , ( ) => {
39
39
beforeEach ( ( ) => {
40
- linkify . registerCustomProtocol ( 'instagram' , true ) ;
41
40
linkify . registerCustomProtocol ( 'view-source' ) ;
41
+ linkify . registerCustomProtocol ( 'instagram' , true ) ;
42
+ linkify . registerCustomProtocol ( 'magnet' , true ) ;
42
43
} ) ;
43
44
44
45
it ( 'Detects basic protocol' , ( ) => {
@@ -49,6 +50,12 @@ describe('linkifyjs', () => {
49
50
expect ( linkify . test ( 'instagram://user/nfrasser' , 'url' ) ) . to . be . ok ;
50
51
} ) ;
51
52
53
+ it ( 'Detects magnet protocol' , ( ) => {
54
+ const magnetLink =
55
+ 'magnet:?xt=urn:btih:5a7f5e0f3ce439e2f1a83e718a8405ec8809110b&dn=ernfkjenrkfk%5FSQ80%5FV%5Fv1.0.0%5Ferfnkerkf%5Ferfnkerkfefrfvegrteggt.net.rar' ;
56
+ expect ( linkify . test ( magnetLink , 'url' ) ) . to . be . ok ;
57
+ } ) ;
58
+
52
59
it ( 'Detects compound protocol' , ( ) => {
53
60
expect ( linkify . test ( 'view-source://http://github.com/' , 'url' ) ) . to . be . ok ;
54
61
} ) ;
You can’t perform that action at this time.
0 commit comments