Merge pull request #10821 from nextcloud/backport/10471/improve-url-detection

[stable13] Improve URL detection
This commit is contained in:
blizzz 2018-08-23 15:25:31 +02:00 committed by GitHub
commit 8a8eb605b4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 1 deletions

View File

@ -21,7 +21,7 @@
* The downside: anything not ascii is excluded. Not sure how common it is in areas using different * 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 * alphabets the upside: fake domains with similar looking characters won't be formatted as links
*/ */
urlRegex: /(\s|^)(https?:\/\/)?((?:[-A-Z0-9+_]*\.)+[-A-Z]+(?:\/[-A-Z0-9+&@#%?=~_|!:,.;()]*)*)(\s|$)/ig, urlRegex: /(\s|^)(https?:\/\/)?((?:[-A-Z0-9+_]+\.)+[-A-Z]+(?:\/[-A-Z0-9+&@#%?=~_|!:,.;()]*)*)(\s|$)/ig,
plainToRich: function(content) { plainToRich: function(content) {
content = this.formatLinksRich(content); content = this.formatLinksRich(content);

View File

@ -38,6 +38,7 @@ describe('OCP.Comments tests', function() {
{input: 'hi noreply@nextcloud.com', expected: 'hi noreply@nextcloud.com'}, {input: 'hi noreply@nextcloud.com', expected: 'hi noreply@nextcloud.com'},
{input: 'hi <noreply@nextcloud.com>', expected: 'hi <noreply@nextcloud.com>'}, {input: 'hi <noreply@nextcloud.com>', expected: 'hi <noreply@nextcloud.com>'},
{input: 'FirebaseInstanceId.getInstance().deleteInstanceId()', expected: 'FirebaseInstanceId.getInstance().deleteInstanceId()'}, {input: 'FirebaseInstanceId.getInstance().deleteInstanceId()', expected: 'FirebaseInstanceId.getInstance().deleteInstanceId()'},
{input: 'I mean...it', expected: 'I mean...it'},
]; ];
} }