diff options
author | Joas Schilling <coding@schilljs.com> | 2023-06-23 09:50:46 +0200 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2023-07-11 07:35:50 +0200 |
commit | 308fc8d8edcd0cbb2b8554f53af1ab2a7bf4d486 (patch) | |
tree | 5c6bd48e99702fb7a87a320b5c46d8ac79ac8ed9 /apps/dav/lib/Connector/Sabre/BlockLegacyClientPlugin.php | |
parent | 2c6f32cb28416a59084ac3069d06b3fb241fa02c (diff) | |
download | nextcloud-server-308fc8d8edcd0cbb2b8554f53af1ab2a7bf4d486.tar.gz nextcloud-server-308fc8d8edcd0cbb2b8554f53af1ab2a7bf4d486.zip |
fix(dav): Use IRequest constant to match version
The pattern matches since a 10 year old client version
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'apps/dav/lib/Connector/Sabre/BlockLegacyClientPlugin.php')
-rw-r--r-- | apps/dav/lib/Connector/Sabre/BlockLegacyClientPlugin.php | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/apps/dav/lib/Connector/Sabre/BlockLegacyClientPlugin.php b/apps/dav/lib/Connector/Sabre/BlockLegacyClientPlugin.php index 257068b9576..5d3f7104d6a 100644 --- a/apps/dav/lib/Connector/Sabre/BlockLegacyClientPlugin.php +++ b/apps/dav/lib/Connector/Sabre/BlockLegacyClientPlugin.php @@ -26,6 +26,7 @@ namespace OCA\DAV\Connector\Sabre; use OCP\IConfig; +use OCP\IRequest; use Sabre\DAV\ServerPlugin; use Sabre\HTTP\RequestInterface; use Sabre\DAV\Server; @@ -65,10 +66,7 @@ class BlockLegacyClientPlugin extends ServerPlugin { } $minimumSupportedDesktopVersion = $this->config->getSystemValue('minimum.supported.desktop.version', '2.3.0'); - - // Match on the mirall version which is in scheme "Mozilla/5.0 (%1) mirall/%2" or - // "mirall/%1" for older releases - preg_match("/(?:mirall\\/)([\d.]+)/i", $userAgent, $versionMatches); + preg_match(IRequest::USER_AGENT_CLIENT_DESKTOP, $userAgent, $versionMatches); if (isset($versionMatches[1]) && version_compare($versionMatches[1], $minimumSupportedDesktopVersion) === -1) { throw new \Sabre\DAV\Exception\Forbidden('Unsupported client version.'); |