Skip to content

Commit 7670c30

Browse files
committed
Update BlockLegacyClientPluginTest to reflect the new 403 error message.
Signed-off-by: Camila Ayres <[email protected]>
1 parent 53e8c97 commit 7670c30

2 files changed

Lines changed: 15 additions & 7 deletions

File tree

apps/dav/lib/Connector/Sabre/BlockLegacyClientPlugin.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public function beforeHandler(RequestInterface $request) {
7070
if (isset($versionMatches[1]) &&
7171
version_compare($versionMatches[1], $minimumSupportedDesktopVersion) === -1) {
7272
$customClientDesktopLink = $this->config->getSystemValue('customclient_desktop', 'https://nextcloud.com/install/#install-clients');
73-
throw new \Sabre\DAV\Exception\Forbidden('This version of the client is unsupported. Upgrade to version '.$minimumSupportedDesktopVersion.' or later. Please open '.$customClientDesktopLink.' to download the update.');
73+
throw new \Sabre\DAV\Exception\Forbidden('This version of the client is unsupported. Upgrade to <a href="'.$customClientDesktopLink.'">version '.$minimumSupportedDesktopVersion.' or later</a>.');
7474
}
7575
}
7676
}

apps/dav/tests/unit/Connector/Sabre/BlockLegacyClientPluginTest.php

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,20 @@ public function oldDesktopClientProvider(): array {
6464
*/
6565
public function testBeforeHandlerException(string $userAgent): void {
6666
$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
67-
$this->expectExceptionMessage('Unsupported client version.');
67+
68+
$this->config
69+
->expects($this->once())
70+
->method('getSystemValue')
71+
->with('customclient_desktop', 'https://nextcloud.com/install/#install-clients')
72+
->willReturn('https://nextcloud.com/install/#install-clients');
73+
74+
$this->config
75+
->expects($this->once())
76+
->method('getSystemValue')
77+
->with('minimum.supported.desktop.version', '2.3.0')
78+
->willReturn('1.7.0');
79+
80+
$this->expectExceptionMessage('This version of the client is unsupported. Upgrade to <a href="https://nextcloud.com/install/#install-clients">version 1.7.0 or later</a>.');
6881

6982
/** @var RequestInterface|MockObject $request */
7083
$request = $this->createMock('\Sabre\HTTP\RequestInterface');
@@ -74,11 +87,6 @@ public function testBeforeHandlerException(string $userAgent): void {
7487
->with('User-Agent')
7588
->willReturn($userAgent);
7689

77-
$this->config
78-
->expects($this->once())
79-
->method('getSystemValue')
80-
->with('minimum.supported.desktop.version', '2.3.0')
81-
->willReturn('1.7.0');
8290

8391
$this->blockLegacyClientVersionPlugin->beforeHandler($request);
8492
}

0 commit comments

Comments
 (0)