aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2024-12-18 16:25:05 +0100
committerRobin Appelman <robin@icewind.nl>2025-02-20 16:49:11 +0100
commitf5534b96d86799be6be00631f6f10df42a25fe7b (patch)
treea005d5890e361517c1757a20070c2748a210ecb0
parentc23cdf609c38966f00fd44866086767eb7d5f1b2 (diff)
downloadnextcloud-server-notfound-debug-mounts-30.tar.gz
nextcloud-server-notfound-debug-mounts-30.zip
debug: add header to debug mounts when dav throws not foundnotfound-debug-mounts-30
Signed-off-by: Robin Appelman <robin@icewind.nl>
-rw-r--r--apps/dav/lib/Connector/Sabre/Directory.php13
1 files changed, 13 insertions, 0 deletions
diff --git a/apps/dav/lib/Connector/Sabre/Directory.php b/apps/dav/lib/Connector/Sabre/Directory.php
index d56f56890cc..76c0ab6abdd 100644
--- a/apps/dav/lib/Connector/Sabre/Directory.php
+++ b/apps/dav/lib/Connector/Sabre/Directory.php
@@ -17,6 +17,8 @@ use OCP\Files\FileInfo;
use OCP\Files\Folder;
use OCP\Files\ForbiddenException;
use OCP\Files\InvalidPathException;
+use OCP\Files\Mount\IMountManager;
+use OCP\Files\Mount\IMountPoint;
use OCP\Files\NotPermittedException;
use OCP\Files\StorageNotAvailableException;
use OCP\IL10N;
@@ -185,6 +187,17 @@ class Directory extends \OCA\DAV\Connector\Sabre\Node implements \Sabre\DAV\ICol
}
if (!$info) {
+ if (!$request) {
+ $request = \OC::$server->get(IRequest::class);
+ }
+ if ($request->getHeader('debug_not_found')) {
+ /** @var IMountManager $mountManager */
+ $mountManager = \OC::$server->get(IMountManager::class);
+ $mounts = array_map(function (IMountPoint $mountPoint) {
+ return $mountPoint->getMountPoint();
+ }, $mountManager->getAll());
+ throw new \Sabre\DAV\Exception\NotFound('File with name ' . $path . ' could not be located, available mounts: ' . implode(', ', $mounts));
+ }
throw new \Sabre\DAV\Exception\NotFound('File with name ' . $path . ' could not be located');
}