aboutsummaryrefslogtreecommitdiffstats
path: root/apps/dav/lib
diff options
context:
space:
mode:
authorJoas Schilling <213943+nickvergessen@users.noreply.github.com>2023-07-11 11:36:54 +0200
committerGitHub <noreply@github.com>2023-07-11 11:36:54 +0200
commite285d72c10924999e1243ef0482498f32d6443c2 (patch)
treec951e01355497af5a3f93fef844431d694f3e601 /apps/dav/lib
parent12ee2581aa943da93054f7839fecc8f83eb3cee1 (diff)
parent33913ebc344f84de88b3e58accc137801e90edb4 (diff)
downloadnextcloud-server-e285d72c10924999e1243ef0482498f32d6443c2.tar.gz
nextcloud-server-e285d72c10924999e1243ef0482498f32d6443c2.zip
Merge pull request #38561 from nextcloud/feat/noid/allow-to-match-client-versions-with-regex
feat(request): Allow to match the client version with the IRequest::U…
Diffstat (limited to 'apps/dav/lib')
-rw-r--r--apps/dav/lib/Connector/Sabre/BlockLegacyClientPlugin.php6
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.');