diff --git a/core/src/OCP/comments.js b/core/src/OCP/comments.js index cd1e8a8fa77..9e182aeef3e 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+_.]+(?::[0-9]+)?(?:\/[-A-Z0-9+&@#%?=~_|!:,.;()]*)*)(\s|$)/ig /** * @param {any} content - diff --git a/lib/public/IURLGenerator.php b/lib/public/IURLGenerator.php index f62503f14ec..0c7dc070778 100644 --- a/lib/public/IURLGenerator.php +++ b/lib/public/IURLGenerator.php @@ -51,7 +51,7 @@ interface IURLGenerator { * * @since 25.0.0 */ - public const URL_REGEX_NO_MODIFIERS = '(\s|\n|^)(https?:\/\/)((?:[-A-Z0-9+_]+\.)+[-A-Z]+(?:\/[-A-Z0-9+&@#%?=~_|!:,.;()]*)*)(\s|\n|$)'; + public const URL_REGEX_NO_MODIFIERS = '(\s|\n|^)(https?:\/\/)([-A-Z0-9+_.]+(?::[0-9]+)?(?:\/[-A-Z0-9+&@#%?=~_|!:,.;()]*)*)(\s|\n|$)'; /** * Returns the URL for a route