aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Kesselberg <mail@danielkesselberg.de>2025-01-24 15:22:15 +0100
committerDaniel <mail@danielkesselberg.de>2025-01-28 12:42:33 +0100
commit92eb005fd2140481a4eff6d4823c0f96290f39d9 (patch)
treefe2e8ee5b5cc6bac4067a4177b8e7d91eb63e6f8
parent2c773033bcf44268cad1e427fffdb9bbcc6a0327 (diff)
downloadnextcloud-server-bug/noid/log-absolute-path-for-locked-exception-through-view.tar.gz
nextcloud-server-bug/noid/log-absolute-path-for-locked-exception-through-view.zip
fix: log absolute path for locked exceptionbug/noid/log-absolute-path-for-locked-exception-through-view
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
-rw-r--r--apps/dav/lib/Connector/Sabre/Directory.php4
-rw-r--r--apps/dav/lib/Connector/Sabre/File.php2
-rw-r--r--lib/private/Files/View.php34
3 files changed, 20 insertions, 20 deletions
diff --git a/apps/dav/lib/Connector/Sabre/Directory.php b/apps/dav/lib/Connector/Sabre/Directory.php
index ebef7f91ee0..71113d642d4 100644
--- a/apps/dav/lib/Connector/Sabre/Directory.php
+++ b/apps/dav/lib/Connector/Sabre/Directory.php
@@ -111,11 +111,11 @@ class Directory extends Node implements \Sabre\DAV\ICollection, \Sabre\DAV\IQuot
// only allow 1 process to upload a file at once but still allow reading the file while writing the part file
$node->acquireLock(ILockingProvider::LOCK_SHARED);
- $this->fileView->lockFile($path . '.upload.part', ILockingProvider::LOCK_EXCLUSIVE);
+ $this->fileView->lockFile($node->getPath() . '.upload.part', ILockingProvider::LOCK_EXCLUSIVE);
$result = $node->put($data);
- $this->fileView->unlockFile($path . '.upload.part', ILockingProvider::LOCK_EXCLUSIVE);
+ $this->fileView->unlockFile($node->getPath() . '.upload.part', ILockingProvider::LOCK_EXCLUSIVE);
$node->releaseLock(ILockingProvider::LOCK_SHARED);
return $result;
} catch (StorageNotAvailableException $e) {
diff --git a/apps/dav/lib/Connector/Sabre/File.php b/apps/dav/lib/Connector/Sabre/File.php
index d6bd6369c9d..3fae774f163 100644
--- a/apps/dav/lib/Connector/Sabre/File.php
+++ b/apps/dav/lib/Connector/Sabre/File.php
@@ -273,7 +273,7 @@ class File extends Node implements IFile {
}
}
} catch (\Exception $e) {
- if ($e instanceof LockedException) {
+ if ($e instanceof FileLocked) {
\OC::$server->get(LoggerInterface::class)->debug($e->getMessage(), ['exception' => $e]);
} else {
\OC::$server->get(LoggerInterface::class)->error($e->getMessage(), ['exception' => $e]);
diff --git a/lib/private/Files/View.php b/lib/private/Files/View.php
index 072d3520ae9..01f3a827322 100644
--- a/lib/private/Files/View.php
+++ b/lib/private/Files/View.php
@@ -2062,11 +2062,15 @@ class View {
);
}
} catch (LockedException $e) {
- // rethrow with the a human-readable path
+ $this->logger->debug($e->getMessage(), [
+ 'exception' => $e,
+ 'fakeRoot' => $this->fakeRoot,
+ 'absolutePath' => $absolutePath,
+ ]);
throw new LockedException(
- $this->getPathRelativeToFiles($absolutePath),
+ $this->getRelativePath($absolutePath) ?? $e->getPath(),
$e,
- $e->getExistingLock()
+ $e->getExistingLock(),
);
}
@@ -2102,20 +2106,16 @@ class View {
);
}
} catch (LockedException $e) {
- try {
- // rethrow with the a human-readable path
- throw new LockedException(
- $this->getPathRelativeToFiles($absolutePath),
- $e,
- $e->getExistingLock()
- );
- } catch (\InvalidArgumentException $ex) {
- throw new LockedException(
- $absolutePath,
- $ex,
- $e->getExistingLock()
- );
- }
+ $this->logger->debug($e->getMessage(), [
+ 'exception' => $e,
+ 'fakeRoot' => $this->fakeRoot,
+ 'absolutePath' => $absolutePath,
+ ]);
+ throw new LockedException(
+ $this->getRelativePath($absolutePath) ?? $e->getPath(),
+ $e,
+ $e->getExistingLock(),
+ );
}
return true;