Skip to content

Commit

Permalink
Merge pull request #2262 from nextcloud/bugfix/noid/wrapper-return-type
Browse files Browse the repository at this point in the history
  • Loading branch information
juliusknorr authored Feb 14, 2023
2 parents 9ffd181 + 791af75 commit d817a22
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 9 deletions.
57 changes: 53 additions & 4 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/ACL/ACLManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion lib/ACL/ACLStorageWrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
10 changes: 8 additions & 2 deletions lib/Controller/FolderController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
}

Expand Down
2 changes: 1 addition & 1 deletion lib/Versions/GroupVersion.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function __construct(
int $timestamp,
int $revisionId,
string $name,
int $size,
float|int $size,
string $mimetype,
string $path,
FileInfo $sourceFileInfo,
Expand Down

0 comments on commit d817a22

Please sign in to comment.