diff options
author | Robin Appelman <robin@icewind.nl> | 2024-12-18 16:25:05 +0100 |
---|---|---|
committer | Robin Appelman <robin@icewind.nl> | 2024-12-18 16:25:05 +0100 |
commit | 0e169a31edbf1ca1c8661a6d7900537ee637764d (patch) | |
tree | abef006103f6e52aa3d932a78e47e1f7745f0402 | |
parent | 407ac7f739a7cb2136fa717b06c9163b05f36def (diff) | |
download | nextcloud-server-notfound-debug-mounts.tar.gz nextcloud-server-notfound-debug-mounts.zip |
debug: add header to debug mounts when dav throws not foundnotfound-debug-mounts
Signed-off-by: Robin Appelman <robin@icewind.nl>
-rw-r--r-- | apps/dav/lib/Connector/Sabre/Directory.php | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/apps/dav/lib/Connector/Sabre/Directory.php b/apps/dav/lib/Connector/Sabre/Directory.php index ebef7f91ee0..07353389b69 100644 --- a/apps/dav/lib/Connector/Sabre/Directory.php +++ b/apps/dav/lib/Connector/Sabre/Directory.php @@ -18,6 +18,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\NotFoundException; use OCP\Files\NotPermittedException; use OCP\Files\StorageNotAvailableException; @@ -191,6 +193,18 @@ class Directory extends Node implements \Sabre\DAV\ICollection, \Sabre\DAV\IQuot } if (!$info) { + if (!$request) { + $request = \OC::$server->get(IRequest::class); + } + $a = $request->getHttpProtocol(); + if ($request->getHeader('debug_not_found')) { + /** @var @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'); } |