Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions apps/files_external/lib/Lib/Storage/SMB.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,13 +172,21 @@ protected function getFileInfo(string $path): IFileInfo {
}
} 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);
}
Expand Down
Loading