From 483305c9e46d6daf34742f29642e09267496a46a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Calvi=C3=B1o=20S=C3=A1nchez?= Date: Tue, 8 Apr 2025 07:20:31 +0200 Subject: [PATCH 1/2] fix: Handle missing share providers when promoting reshares MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The provider for mail shares is not available when the "sharebymail" app is disabled, and in that case a "ProviderException" is thrown when trying to get it. Signed-off-by: Daniel Calviño Sánchez --- lib/private/Share20/Manager.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/private/Share20/Manager.php b/lib/private/Share20/Manager.php index f0cf3f45b15f6..db13a72e0bd2a 100644 --- a/lib/private/Share20/Manager.php +++ b/lib/private/Share20/Manager.php @@ -1215,7 +1215,12 @@ protected function promoteReshares(IShare $share): void { foreach ($userIds as $userId) { foreach ($shareTypes as $shareType) { - $provider = $this->factory->getProviderForType($shareType); + try { + $provider = $this->factory->getProviderForType($shareType); + } catch (ProviderException $e) { + continue; + } + if ($node instanceof Folder) { /* We need to get all shares by this user to get subshares */ $shares = $provider->getSharesBy($userId, $shareType, null, false, -1, 0); From fa9edf3c7777fe7bd17e1dde0fd39cc90d6f01cb Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Mon, 14 Apr 2025 09:39:40 +0200 Subject: [PATCH 2/2] test: adjust broken tests Signed-off-by: Ferdinand Thiessen --- tests/lib/Share20/ManagerTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/lib/Share20/ManagerTest.php b/tests/lib/Share20/ManagerTest.php index e69afda4ada9c..461bddf3db68e 100644 --- a/tests/lib/Share20/ManagerTest.php +++ b/tests/lib/Share20/ManagerTest.php @@ -2273,7 +2273,7 @@ public function testLinkCreateChecksReadOnly() { public function testPathCreateChecksContainsSharedMount() { $this->expectException(\InvalidArgumentException::class); - $this->expectExceptionMessage('You cannot share a folder that contains other shares'); + $this->expectExceptionMessage('Path contains files shared with you'); $path = $this->createMock(Folder::class); $path->method('getPath')->willReturn('path');