diff options
author | Morris Jobke <hey@morrisjobke.de> | 2018-07-11 12:41:32 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-11 12:41:32 +0300 |
commit | cc09db6c5b1b892b32a83b4e57eada03de2b4eff (patch) | |
tree | 83759a8a00109bc71081bc1b550d14810806f04a | |
parent | a9b4be205a01f8b3d3a1b55b807f980b4fb83a51 (diff) | |
parent | 4e99dc2318ade0ce4278c9edd28d49e4828242b5 (diff) |
Merge pull request #10189 from nextcloud/backport/10020/email-address-misparsed-in-comments-and-chat
[stable13] Fix "parsing" of email-addresses in comments and chat messages
-rw-r--r-- | core/js/public/comments.js | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/core/js/public/comments.js b/core/js/public/comments.js index ac0bf8e0ab7..318d527b13d 100644 --- a/core/js/public/comments.js +++ b/core/js/public/comments.js @@ -21,7 +21,7 @@ * The downside: anything not ascii is excluded. Not sure how common it is in areas using different * alphabets… the upside: fake domains with similar looking characters won't be formatted as links */ - urlRegex: /(\b(https?:\/\/|([-A-Z0-9+_])*\.([-A-Z])+)[-A-Z0-9+&@#\/%?=~_|!:,.;()]*[-A-Z0-9+&@#\/%=~_|()])/ig, + urlRegex: /((\s|^)(https?:\/\/|([-A-Z0-9+_])*\.([-A-Z])+)[-A-Z0-9+&@#\/%?=~_|!:,.;()]*[-A-Z0-9+&@#\/%=~_|()])/ig, protocolRegex: /^https:\/\//, plainToRich: function(content) { @@ -39,7 +39,7 @@ return content.replace(this.urlRegex, function(url) { var hasProtocol = (url.indexOf('https://') !== -1) || (url.indexOf('http://') !== -1); if(!hasProtocol) { - url = 'https://' + url; + url = 'https://' + url.trim(); } var linkText = url.replace(self.protocolRegex, ''); |