Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Adapt return type for Nextcloud 26 #2262

Merged
merged 4 commits into from
Feb 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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