diff --git a/composer.lock b/composer.lock index 760c6b5e8..15e8c41fb 100644 --- a/composer.lock +++ b/composer.lock @@ -696,16 +696,17 @@ "source": { "type": "git", "url": "https://github.com/nextcloud-deps/ocp.git", - "reference": "bf16e87ef27d0c3d5812cc2352ecf50f2b96e669" + "reference": "5c5b6d8600ddaf9f466736e34103b2921cc9b0e3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nextcloud-deps/ocp/zipball/bf16e87ef27d0c3d5812cc2352ecf50f2b96e669", - "reference": "bf16e87ef27d0c3d5812cc2352ecf50f2b96e669", + "url": "https://api.github.com/repos/nextcloud-deps/ocp/zipball/5c5b6d8600ddaf9f466736e34103b2921cc9b0e3", + "reference": "5c5b6d8600ddaf9f466736e34103b2921cc9b0e3", "shasum": "" }, "require": { "php": "^7.4 || ~8.0 || ~8.1", + "psr/clock": "^1.0", "psr/container": "^1.1.1", "psr/event-dispatcher": "^1.0", "psr/log": "^1.1" @@ -732,7 +733,7 @@ "issues": "https://github.com/nextcloud-deps/ocp/issues", "source": "https://github.com/nextcloud-deps/ocp/tree/master" }, - "time": "2022-12-17T00:35:01+00:00" + "time": "2023-02-09T00:37:24+00:00" }, { "name": "nikic/php-parser", @@ -1457,6 +1458,54 @@ }, "time": "2016-08-06T20:24:11+00:00" }, + { + "name": "psr/clock", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/clock.git", + "reference": "e41a24703d4560fd0acb709162f73b8adfc3aa0d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/clock/zipball/e41a24703d4560fd0acb709162f73b8adfc3aa0d", + "reference": "e41a24703d4560fd0acb709162f73b8adfc3aa0d", + "shasum": "" + }, + "require": { + "php": "^7.0 || ^8.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Psr\\Clock\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for reading the clock.", + "homepage": "https://github.com/php-fig/clock", + "keywords": [ + "clock", + "now", + "psr", + "psr-20", + "time" + ], + "support": { + "issues": "https://github.com/php-fig/clock/issues", + "source": "https://github.com/php-fig/clock/tree/1.0.0" + }, + "time": "2022-11-25T14:36:26+00:00" + }, { "name": "psr/container", "version": "1.1.2", diff --git a/lib/ACL/ACLManager.php b/lib/ACL/ACLManager.php index 316e850f0..21718a8f6 100644 --- a/lib/ACL/ACLManager.php +++ b/lib/ACL/ACLManager.php @@ -49,7 +49,7 @@ private function getRootStorageId(): int { $provider = $this->rootFolderProvider; /** @var IRootFolder $rootFolder */ $rootFolder = $provider(); - $this->rootStorageId = $rootFolder->getMountPoint()->getNumericStorageId(); + $this->rootStorageId = $rootFolder->getMountPoint()->getNumericStorageId() ?? -1; } return $this->rootStorageId; diff --git a/lib/ACL/ACLStorageWrapper.php b/lib/ACL/ACLStorageWrapper.php index 0b7026b9b..265496802 100644 --- a/lib/ACL/ACLStorageWrapper.php +++ b/lib/ACL/ACLStorageWrapper.php @@ -232,7 +232,7 @@ public function filetype($path) { return parent::filetype($path); } - public function filesize($path) { + public function filesize($path): false|int|float { if (!$this->checkPermissions($path, Constants::PERMISSION_READ)) { return false; } diff --git a/lib/Controller/FolderController.php b/lib/Controller/FolderController.php index d7dd65986..d03bfcc88 100644 --- a/lib/Controller/FolderController.php +++ b/lib/Controller/FolderController.php @@ -26,6 +26,7 @@ use OCA\GroupFolders\Mount\MountProvider; use OCA\GroupFolders\Service\DelegationService; use OCA\GroupFolders\Service\FoldersFilter; +use OCP\AppFramework\Http; use OCP\AppFramework\Http\DataResponse; use OCP\AppFramework\OCSController; use OCP\Files\IRootFolder; @@ -84,10 +85,15 @@ public function getFolders(): DataResponse { * @RequireGroupFolderAdmin */ public function getFolder(int $id): DataResponse { - return new DataResponse($this->manager->getFolder($id, $this->getRootFolderStorageId())); + $storageId = $this->getRootFolderStorageId(); + if ($storageId === null) { + return new DataResponse([], Http::STATUS_NOT_FOUND); + } + + return new DataResponse($this->manager->getFolder($id, $storageId)); } - private function getRootFolderStorageId(): int { + private function getRootFolderStorageId(): ?int { return $this->rootFolder->getMountPoint()->getNumericStorageId(); } diff --git a/lib/Versions/GroupVersion.php b/lib/Versions/GroupVersion.php index 9fb2b30b4..6e40fd780 100644 --- a/lib/Versions/GroupVersion.php +++ b/lib/Versions/GroupVersion.php @@ -40,7 +40,7 @@ public function __construct( int $timestamp, int $revisionId, string $name, - int $size, + float|int $size, string $mimetype, string $path, FileInfo $sourceFileInfo,