mirror of
https://github.com/nextcloud/server.git
synced 2026-05-28 04:32:30 -04:00
Merge pull request #34350 from nextcloud/bugfix/34278/add-capability-for-the-reference-api
Add a capability for the reference API and expose the regex to clients
This commit is contained in:
commit
f888f99b0a
2 changed files with 14 additions and 2 deletions
|
|
@ -24,6 +24,7 @@ namespace OC\OCS;
|
|||
|
||||
use OCP\Capabilities\ICapability;
|
||||
use OCP\IConfig;
|
||||
use OCP\IURLGenerator;
|
||||
|
||||
/**
|
||||
* Class Capabilities
|
||||
|
|
@ -52,7 +53,9 @@ class CoreCapabilities implements ICapability {
|
|||
'core' => [
|
||||
'pollinterval' => $this->config->getSystemValue('pollinterval', 60),
|
||||
'webdav-root' => $this->config->getSystemValue('webdav-root', 'remote.php/webdav'),
|
||||
]
|
||||
'reference-api' => true,
|
||||
'reference-regex' => IURLGenerator::URL_REGEX_NO_MODIFIERS,
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,7 +43,16 @@ interface IURLGenerator {
|
|||
*
|
||||
* @since 25.0.0
|
||||
*/
|
||||
public const URL_REGEX = '/(\s|\n|^)(https?:\/\/)((?:[-A-Z0-9+_]+\.)+[-A-Z]+(?:\/[-A-Z0-9+&@#%?=~_|!:,.;()]*)*)(\s|\n|$)/mi';
|
||||
public const URL_REGEX = '/' . self::URL_REGEX_NO_MODIFIERS . '/mi';
|
||||
|
||||
/**
|
||||
* Regex for matching http(s) urls (without modifiers for client compatibility)
|
||||
*
|
||||
* This is a copy of the frontend regex in core/src/OCP/comments.js, make sure to adjust both when changing
|
||||
*
|
||||
* @since 25.0.0
|
||||
*/
|
||||
public const URL_REGEX_NO_MODIFIERS = '(\s|\n|^)(https?:\/\/)((?:[-A-Z0-9+_]+\.)+[-A-Z]+(?:\/[-A-Z0-9+&@#%?=~_|!:,.;()]*)*)(\s|\n|$)';
|
||||
|
||||
/**
|
||||
* Returns the URL for a route
|
||||
|
|
|
|||
Loading…
Reference in a new issue