mirror of
https://github.com/nextcloud/server.git
synced 2026-03-12 05:33:11 -04:00
Merge pull request #53426 from nextcloud/smb-open-failure-log
feat: improve logging of fopen failures for smb
This commit is contained in:
commit
07bf0099a1
1 changed files with 8 additions and 2 deletions
|
|
@ -198,7 +198,7 @@ class SMB extends Common implements INotifyStorage {
|
|||
try {
|
||||
$acls = $file->getAcls();
|
||||
} catch (Exception $e) {
|
||||
$this->logger->error('Error while getting file acls', ['exception' => $e]);
|
||||
$this->logger->warning('Error while getting file acls', ['exception' => $e]);
|
||||
return null;
|
||||
}
|
||||
foreach ($acls as $user => $acl) {
|
||||
|
|
@ -426,6 +426,7 @@ class SMB extends Common implements INotifyStorage {
|
|||
case 'r':
|
||||
case 'rb':
|
||||
if (!$this->file_exists($path)) {
|
||||
$this->logger->warning('Failed to open ' . $path . ' on ' . $this->getId() . ', file doesn\'t exist.');
|
||||
return false;
|
||||
}
|
||||
return $this->share->read($fullPath);
|
||||
|
|
@ -453,11 +454,13 @@ class SMB extends Common implements INotifyStorage {
|
|||
}
|
||||
if ($this->file_exists($path)) {
|
||||
if (!$this->isUpdatable($path)) {
|
||||
$this->logger->warning('Failed to open ' . $path . ' on ' . $this->getId() . ', file not updatable.');
|
||||
return false;
|
||||
}
|
||||
$tmpFile = $this->getCachedFile($path);
|
||||
} else {
|
||||
if (!$this->isCreatable(dirname($path))) {
|
||||
$this->logger->warning('Failed to open ' . $path . ' on ' . $this->getId() . ', parent directory not writable.');
|
||||
return false;
|
||||
}
|
||||
$tmpFile = \OCP\Server::get(ITempManager::class)->getTemporaryFile($ext);
|
||||
|
|
@ -472,13 +475,16 @@ class SMB extends Common implements INotifyStorage {
|
|||
}
|
||||
return false;
|
||||
} catch (NotFoundException $e) {
|
||||
$this->logger->warning('Failed to open ' . $path . ' on ' . $this->getId() . ', not found.', ['exception' => $e]);
|
||||
return false;
|
||||
} catch (ForbiddenException $e) {
|
||||
$this->logger->warning('Failed to open ' . $path . ' on ' . $this->getId() . ', forbidden.', ['exception' => $e]);
|
||||
return false;
|
||||
} catch (OutOfSpaceException $e) {
|
||||
$this->logger->warning('Failed to open ' . $path . ' on ' . $this->getId() . ', out of space.', ['exception' => $e]);
|
||||
throw new EntityTooLargeException('not enough available space to create file', 0, $e);
|
||||
} catch (ConnectException $e) {
|
||||
$this->logger->error('Error while opening file', ['exception' => $e]);
|
||||
$this->logger->error('Error while opening file ' . $path . ' on ' . $this->getId(), ['exception' => $e]);
|
||||
throw new StorageNotAvailableException($e->getMessage(), (int)$e->getCode(), $e);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue