aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2025-06-10 15:14:04 +0200
committerRobin Appelman <robin@icewind.nl>2025-06-10 15:14:04 +0200
commit4242520d6409e3791e643738a4456acbb443f5dd (patch)
tree116daf23e45a6d54c6620a0ab8e646f5ac2fb335
parent6d8b2634f238524b7a04aa902c4df60efbd3366e (diff)
downloadnextcloud-server-smb-open-failure-log.tar.gz
nextcloud-server-smb-open-failure-log.zip
feat: improve logging of fopen failures for smbsmb-open-failure-log
Signed-off-by: Robin Appelman <robin@icewind.nl>
-rw-r--r--apps/files_external/lib/Lib/Storage/SMB.php10
1 files changed, 8 insertions, 2 deletions
diff --git a/apps/files_external/lib/Lib/Storage/SMB.php b/apps/files_external/lib/Lib/Storage/SMB.php
index fc1f9b9ecd1..fe5f3adb25e 100644
--- a/apps/files_external/lib/Lib/Storage/SMB.php
+++ b/apps/files_external/lib/Lib/Storage/SMB.php
@@ -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);
}
}