mirror of
https://github.com/nextcloud/server.git
synced 2026-04-21 14:23:17 -04:00
Merge pull request #57493 from nextcloud/smb-invalid-arg-unavailable
fix: handle InvalidArumentException as availability failure in smb->getFileInfo
This commit is contained in:
commit
9fde2523e6
1 changed files with 10 additions and 2 deletions
|
|
@ -172,13 +172,21 @@ class SMB extends Common implements INotifyStorage {
|
|||
}
|
||||
} catch (ConnectException $e) {
|
||||
$this->throwUnavailable($e);
|
||||
} catch (InvalidArgumentException $e) {
|
||||
$this->throwUnavailable($e);
|
||||
} catch (NotFoundException $e) {
|
||||
throw new \OCP\Files\NotFoundException($e->getMessage(), 0, $e);
|
||||
} catch (ForbiddenException $e) {
|
||||
// with php-smbclient, this exception is thrown when the provided password is invalid.
|
||||
// Possible is also ForbiddenException with a different error code, so we check it.
|
||||
if ($e->getCode() === 1) {
|
||||
// we check if we can stat the root, which should only fail in authentication failures
|
||||
if ($path === '') {
|
||||
$this->throwUnavailable($e);
|
||||
} else {
|
||||
try {
|
||||
$this->share->stat('');
|
||||
} catch (\Exception $e) {
|
||||
$this->throwUnavailable($e);
|
||||
}
|
||||
}
|
||||
throw new \OCP\Files\ForbiddenException($e->getMessage(), false, $e);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue