You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/Autolinker.js
+16-60Lines changed: 16 additions & 60 deletions
Original file line number
Diff line number
Diff line change
@@ -91,6 +91,8 @@
91
91
*/
92
92
varAutolinker=function(cfg){
93
93
Autolinker.Util.assign(this,cfg);// assign the properties of `cfg` onto the Autolinker instance. Prototype properties will be used for missing configs.
(urlMatch&&(!protocolUrlMatch||!(/:\/\//).test(protocolUrlMatch))&&urlMatch.indexOf('.')===-1)||// At least one period ('.') must exist in the URL match for us to consider it an actual URL, *unless* it was a full protocol match (like 'http://localhost')
589
-
(urlMatch&&/^[A-Za-z]{3,9}:/.test(urlMatch)&&!/:.*?[A-Za-z]/.test(urlMatch))||// At least one letter character must exist in the domain name after a protocol match. Ex: skip over something like "git:1.0"
590
-
(protocolRelativeMatch&&this.invalidProtocolRelMatchRegex.test(protocolRelativeMatch))// a protocol-relative match which has a word character in front of it (so we can skip something like "abc//google.com")
591
-
){
592
-
returnfalse;
593
-
}
594
-
595
-
returntrue;
596
-
},
597
-
598
-
599
555
/**
600
556
* Determines if a match found has an unmatched closing parenthesis. If so, this parenthesis will be removed
601
557
* from the match itself, and appended after the generated anchor tag in {@link #processTextNode}.
this.urlMatchDoesNotHaveProtocolOrDot(urlMatch,protocolUrlMatch)||// At least one period ('.') must exist in the URL match for us to consider it an actual URL, *unless* it was a full protocol match (like 'http://localhost')
80
+
this.urlMatchDoesNotHaveAtLeastOneWordChar(urlMatch)||// At least one letter character must exist in the domain name after a protocol match. Ex: skip over something like "git:1.0"
81
+
this.isInvalidProtocolRelativeMatch(protocolRelativeMatch)// A protocol-relative match which has a word character in front of it (so we can skip something like "abc//google.com")
82
+
){
83
+
returnfalse;
84
+
}
85
+
86
+
returntrue;
87
+
},
88
+
89
+
90
+
/**
91
+
* Determines if a URL match does not have either:
92
+
*
93
+
* a) a full protocol (i.e. 'http://'), or
94
+
* b) at least one dot ('.') in the domain name (for a non-full-protocol match).
95
+
*
96
+
* Either situation is considered an invalid URL (ex: 'git:d' does not have either the '://' part, or at least one dot
97
+
* in the domain name. If the match was 'git:abc.com', we would consider this valid.)
98
+
*
99
+
* @private
100
+
* @param {String} urlMatch The matched URL, if there was one. Will be an empty string if the match is not a URL match.
101
+
* @param {String} protocolUrlMatch The match URL string for a protocol match. Ex: 'http://yahoo.com'. This is used to match
102
+
* something like 'http://localhost', where we won't double check that the domain name has at least one '.' in it.
103
+
* @return {Boolean} `true` if the URL match does not have a full protocol, or at least one dot ('.') in a non-full-protocol
0 commit comments