diff --git a/lib/Controller/StorageController.php b/lib/Controller/StorageController.php index a256913..68d98b3 100644 --- a/lib/Controller/StorageController.php +++ b/lib/Controller/StorageController.php @@ -193,8 +193,12 @@ private function validationErrorResponse(array $errors): DataResponse { */ private function resolveUniqueMountPoint(string $mountPoint): string { $existingMountPoints = []; - foreach ($this->globalStoragesService->getAllGlobalStorages() as $storage) { - $existingMountPoints[strtolower($storage->getMountPoint())] = true; + foreach ($this->getGlobalStorages() as $storage) { + if (!method_exists($storage, 'getMountPoint')) { + continue; + } + + $existingMountPoints[strtolower((string) $storage->getMountPoint())] = true; } if (!isset($existingMountPoints[strtolower($mountPoint)])) { @@ -211,6 +215,27 @@ private function resolveUniqueMountPoint(string $mountPoint): string { return $candidateMountPoint; } + /** + * Get global storages with NC32/NC33 compatibility. + * + * @return array + */ + private function getGlobalStorages(): array { + if (method_exists($this->globalStoragesService, 'getAllGlobalStorages')) { + return $this->globalStoragesService->getAllGlobalStorages(); + } + + if (method_exists($this->globalStoragesService, 'getAllStorages')) { + return $this->globalStoragesService->getAllStorages(); + } + + if (method_exists($this->globalStoragesService, 'getStorages')) { + return $this->globalStoragesService->getStorages(); + } + + return []; + } + /** * Validate storage connectivity before persisting config. */