aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorLuka Trovic <luka@nextcloud.com>2024-08-07 11:13:35 +0200
committerCôme Chilliet <91878298+come-nc@users.noreply.github.com>2024-10-14 11:58:47 +0200
commit42181c2f490025860e22907255b6917583c798af (patch)
treebfef507c7b08551af4113fb70f75d9d88f7fd4e6 /apps
parent3f75c4808d5153588c671c6a47c6aadb501f6308 (diff)
downloadnextcloud-server-42181c2f490025860e22907255b6917583c798af.tar.gz
nextcloud-server-42181c2f490025860e22907255b6917583c798af.zip
fix: delete re-shares when deleting the parent share
Note: Removed part about fix command from original PR Signed-off-by: Luka Trovic <luka@nextcloud.com> Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Diffstat (limited to 'apps')
-rw-r--r--apps/files/lib/Service/OwnershipTransferService.php3
-rw-r--r--apps/files_sharing/tests/EtagPropagationTest.php3
2 files changed, 5 insertions, 1 deletions
diff --git a/apps/files/lib/Service/OwnershipTransferService.php b/apps/files/lib/Service/OwnershipTransferService.php
index 5a57fae5075..191145b7a66 100644
--- a/apps/files/lib/Service/OwnershipTransferService.php
+++ b/apps/files/lib/Service/OwnershipTransferService.php
@@ -467,6 +467,9 @@ class OwnershipTransferService {
}
} catch (\OCP\Files\NotFoundException $e) {
$output->writeln('<error>Share with id ' . $share->getId() . ' points at deleted file, skipping</error>');
+ } catch (\OCP\Share\Exceptions\GenericShareException $e) {
+ $output->writeln('<error>Share with id ' . $share->getId() . ' is broken, deleting</error>');
+ $this->shareManager->deleteShare($share);
} catch (\Throwable $e) {
$output->writeln('<error>Could not restore share with id ' . $share->getId() . ':' . $e->getMessage() . ' : ' . $e->getTraceAsString() . '</error>');
}
diff --git a/apps/files_sharing/tests/EtagPropagationTest.php b/apps/files_sharing/tests/EtagPropagationTest.php
index 5a65b1b5389..63270ccc1fe 100644
--- a/apps/files_sharing/tests/EtagPropagationTest.php
+++ b/apps/files_sharing/tests/EtagPropagationTest.php
@@ -277,7 +277,8 @@ class EtagPropagationTest extends PropagationTestCase {
self::TEST_FILES_SHARING_API_USER2,
]);
- $this->assertAllUnchanged();
+ $this->assertEtagsNotChanged([self::TEST_FILES_SHARING_API_USER1, self::TEST_FILES_SHARING_API_USER2, self::TEST_FILES_SHARING_API_USER3]);
+ $this->assertEtagsChanged([self::TEST_FILES_SHARING_API_USER4]);
}
public function testOwnerUnsharesFlatReshares(): void {