From 059cd22c6b7ab609667cb17fcfed1609968700cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Calvi=C3=B1o=20S=C3=A1nchez?= Date: Mon, 19 Jan 2026 12:40:11 +0100 Subject: [PATCH 1/2] fix: Fix handling of deleting share from self MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If a share is deleted from self and it is not a group share it was handled as a user share. However, other types of shares can be deleted from self (for example, circle or room shares), so user shares need to be explicitly checked. Note that as those other share types are not explicitly handled no entry is added to the activity for them, but that was already the case before (this change just prevents an exception to be thrown). Signed-off-by: Daniel Calviño Sánchez --- lib/FilesHooks.php | 2 +- tests/FilesHooksTest.php | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/FilesHooks.php b/lib/FilesHooks.php index 68fe7c2df..99c5763c0 100644 --- a/lib/FilesHooks.php +++ b/lib/FilesHooks.php @@ -826,7 +826,7 @@ public function unShareSelf(IShare $share) { if (in_array($share->getNodeType(), ['file', 'folder'], true)) { if ($share->getShareType() === IShare::TYPE_GROUP) { $this->unshareFromSelfGroup($share); - } else { + } elseif ($share->getShareType() === IShare::TYPE_USER) { $this->unshareFromUser($share); } } diff --git a/tests/FilesHooksTest.php b/tests/FilesHooksTest.php index 302a95a75..5c0611619 100644 --- a/tests/FilesHooksTest.php +++ b/tests/FilesHooksTest.php @@ -1024,6 +1024,8 @@ public function testLeaveShare(): void { ->willReturn('file'); $share->method('getSharedWith') ->willReturn('with'); + $share->method('getShareType') + ->willReturn(IShare::TYPE_USER); $this->settings->expects($this->exactly(3)) ->method('getUserSetting') From d0c888f5fe82de15278889543cc55fdc202669fb Mon Sep 17 00:00:00 2001 From: Anna Larch Date: Thu, 19 Feb 2026 14:37:04 +0100 Subject: [PATCH 2/2] fix(psalm): return empty array if query returns no results Signed-off-by: Anna Larch --- lib/Data.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Data.php b/lib/Data.php index 1be92efb0..79d737b5c 100644 --- a/lib/Data.php +++ b/lib/Data.php @@ -519,7 +519,7 @@ public function getActivitySince(string $user, int $since, bool $byOthers) { $query->andWhere($query->expr()->neq('user', $nameParam)); } - return $query->executeQuery()->fetch(); + return $query->executeQuery()->fetch() ?: []; } /**