mirror of
https://github.com/nextcloud/server.git
synced 2026-05-28 04:32:30 -04:00
fix(dav): Update 403 error message
* The user should get a more friendly warning when their desktop client version is not supported anymore by the server. See #nextcloud/desktop/issues/6273 * Update BlockLegacyClientPluginTest to reflect the new 403 error message. Signed-off-by: Camila Ayres <hello@camilasan.com>
This commit is contained in:
parent
a05e5428c5
commit
0a72756d96
2 changed files with 16 additions and 7 deletions
|
|
@ -51,7 +51,8 @@ class BlockLegacyClientPlugin extends ServerPlugin {
|
|||
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.');
|
||||
$customClientDesktopLink = $this->config->getSystemValue('customclient_desktop', 'https://nextcloud.com/install/#install-clients');
|
||||
throw new \Sabre\DAV\Exception\Forbidden('This version of the client is unsupported. Upgrade to <a href="'.$customClientDesktopLink.'">version '.$minimumSupportedDesktopVersion.' or later</a>.');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,7 +45,20 @@ class BlockLegacyClientPluginTest extends TestCase {
|
|||
*/
|
||||
public function testBeforeHandlerException(string $userAgent): void {
|
||||
$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
|
||||
$this->expectExceptionMessage('Unsupported client version.');
|
||||
|
||||
$this->config
|
||||
->expects($this->once())
|
||||
->method('getSystemValue')
|
||||
->with('customclient_desktop', 'https://nextcloud.com/install/#install-clients')
|
||||
->willReturn('https://nextcloud.com/install/#install-clients');
|
||||
|
||||
$this->config
|
||||
->expects($this->once())
|
||||
->method('getSystemValue')
|
||||
->with('minimum.supported.desktop.version', '2.3.0')
|
||||
->willReturn('1.7.0');
|
||||
|
||||
$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>.');
|
||||
|
||||
/** @var RequestInterface|MockObject $request */
|
||||
$request = $this->createMock('\Sabre\HTTP\RequestInterface');
|
||||
|
|
@ -55,11 +68,6 @@ class BlockLegacyClientPluginTest extends TestCase {
|
|||
->with('User-Agent')
|
||||
->willReturn($userAgent);
|
||||
|
||||
$this->config
|
||||
->expects($this->once())
|
||||
->method('getSystemValue')
|
||||
->with('minimum.supported.desktop.version', '2.3.0')
|
||||
->willReturn('1.7.0');
|
||||
|
||||
$this->blockLegacyClientVersionPlugin->beforeHandler($request);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue