diff options
author | Julius Härtl <jus@bitgrid.net> | 2022-09-30 08:07:47 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-30 08:07:47 +0200 |
commit | 27ce4bd1a41c11ab4ffe076df50a5f42402c8cf2 (patch) | |
tree | d388489d765e430fc71e98a3cd18f672df79bf22 /core | |
parent | 87d4c3d84e97ada31f447b764be2fef612ad4085 (diff) | |
parent | f976d372fef774e1011f92930b4a48b4b6ce270e (diff) | |
download | nextcloud-server-27ce4bd1a41c11ab4ffe076df50a5f42402c8cf2.tar.gz nextcloud-server-27ce4bd1a41c11ab4ffe076df50a5f42402c8cf2.zip |
Merge pull request #34322 from nextcloud/bugfix/noid/limit-url-matching-to-https
Only match http(s) URLs for references
Diffstat (limited to 'core')
-rw-r--r-- | core/js/tests/specs/public/commentsSpec.js | 10 | ||||
-rw-r--r-- | core/src/OCP/comments.js | 2 |
2 files changed, 6 insertions, 6 deletions
diff --git a/core/js/tests/specs/public/commentsSpec.js b/core/js/tests/specs/public/commentsSpec.js index 77b00369cab..e77947bea9d 100644 --- a/core/js/tests/specs/public/commentsSpec.js +++ b/core/js/tests/specs/public/commentsSpec.js @@ -19,19 +19,19 @@ describe('OCP.Comments tests', function() { function dataProvider() { return [ - {input: 'nextcloud.com', expected: '<a class="external" target="_blank" rel="noopener noreferrer" href="https://nextcloud.com">nextcloud.com</a>'}, + {input: 'nextcloud.com', expected: 'nextcloud.com'}, {input: 'http://nextcloud.com', expected: '<a class="external" target="_blank" rel="noopener noreferrer" href="http://nextcloud.com">http://nextcloud.com</a>'}, {input: 'https://nextcloud.com', expected: '<a class="external" target="_blank" rel="noopener noreferrer" href="https://nextcloud.com">nextcloud.com</a>'}, - {input: 'hi nextcloud.com', expected: 'hi <a class="external" target="_blank" rel="noopener noreferrer" href="https://nextcloud.com">nextcloud.com</a>'}, + {input: 'hi nextcloud.com', expected: 'hi nextcloud.com'}, {input: 'hi http://nextcloud.com', expected: 'hi <a class="external" target="_blank" rel="noopener noreferrer" href="http://nextcloud.com">http://nextcloud.com</a>'}, {input: 'hi https://nextcloud.com', expected: 'hi <a class="external" target="_blank" rel="noopener noreferrer" href="https://nextcloud.com">nextcloud.com</a>'}, - {input: 'nextcloud.com foobar', expected: '<a class="external" target="_blank" rel="noopener noreferrer" href="https://nextcloud.com">nextcloud.com</a> foobar'}, + {input: 'nextcloud.com foobar', expected: 'nextcloud.com foobar'}, {input: 'http://nextcloud.com foobar', expected: '<a class="external" target="_blank" rel="noopener noreferrer" href="http://nextcloud.com">http://nextcloud.com</a> foobar'}, {input: 'https://nextcloud.com foobar', expected: '<a class="external" target="_blank" rel="noopener noreferrer" href="https://nextcloud.com">nextcloud.com</a> foobar'}, - {input: 'hi nextcloud.com foobar', expected: 'hi <a class="external" target="_blank" rel="noopener noreferrer" href="https://nextcloud.com">nextcloud.com</a> foobar'}, + {input: 'hi nextcloud.com foobar', expected: 'hi nextcloud.com foobar'}, {input: 'hi http://nextcloud.com foobar', expected: 'hi <a class="external" target="_blank" rel="noopener noreferrer" href="http://nextcloud.com">http://nextcloud.com</a> foobar'}, {input: 'hi https://nextcloud.com foobar', expected: 'hi <a class="external" target="_blank" rel="noopener noreferrer" href="https://nextcloud.com">nextcloud.com</a> foobar'}, - {input: 'hi help.nextcloud.com/category/topic foobar', expected: 'hi <a class="external" target="_blank" rel="noopener noreferrer" href="https://help.nextcloud.com/category/topic">help.nextcloud.com/category/topic</a> foobar'}, + {input: 'hi help.nextcloud.com/category/topic foobar', expected: 'hi help.nextcloud.com/category/topic foobar'}, {input: 'hi http://help.nextcloud.com/category/topic foobar', expected: 'hi <a class="external" target="_blank" rel="noopener noreferrer" href="http://help.nextcloud.com/category/topic">http://help.nextcloud.com/category/topic</a> foobar'}, {input: 'hi https://help.nextcloud.com/category/topic foobar', expected: 'hi <a class="external" target="_blank" rel="noopener noreferrer" href="https://help.nextcloud.com/category/topic">help.nextcloud.com/category/topic</a> foobar'}, {input: 'noreply@nextcloud.com', expected: 'noreply@nextcloud.com'}, diff --git a/core/src/OCP/comments.js b/core/src/OCP/comments.js index 0b44dd7be81..cd1e8a8fa77 100644 --- a/core/src/OCP/comments.js +++ b/core/src/OCP/comments.js @@ -34,7 +34,7 @@ import $ from 'jquery' * * This is a copy of the backend regex in IURLGenerator, make sure to adjust both when changing */ -const urlRegex = /(\s|^)(https?:\/\/)?((?:[-A-Z0-9+_]+\.)+[-A-Z]+(?:\/[-A-Z0-9+&@#%?=~_|!:,.;()]*)*)(\s|$)/ig +const urlRegex = /(\s|^)(https?:\/\/)((?:[-A-Z0-9+_]+\.)+[-A-Z]+(?:\/[-A-Z0-9+&@#%?=~_|!:,.;()]*)*)(\s|$)/ig /** * @param {any} content - |