mirror of
https://github.com/nextcloud/server.git
synced 2026-04-29 01:50:33 -04:00
fix: Make URL pattern regexes match localhost and URLs with ports
E.g. the file reference widget should work with links to Nextcloud on localhost. This adjusts the URL pattern regexes in server to be in sync with the ones in `@nextcloud/vue`. See nextcloud-libraries/nextcloud-vue#5176 for further details. Signed-off-by: Jonas <jonas@freesources.org>
This commit is contained in:
parent
14ef17e5e2
commit
02694411a8
2 changed files with 2 additions and 2 deletions
|
|
@ -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 -
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue