From db86cf8db17e37e162af0507a95f42ce06b3641c Mon Sep 17 00:00:00 2001 From: Daniel Kesselberg Date: Tue, 11 Mar 2025 12:24:18 +0100 Subject: [PATCH 1/5] fix: skip caching lastSeenQuotaUsage for remote shares Signed-off-by: Daniel Kesselberg --- apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php | 2 ++ lib/private/legacy/OC_Helper.php | 11 +++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php b/apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php index 18cef58207d81..f6c19787e94cc 100644 --- a/apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php @@ -286,6 +286,7 @@ public function testGetQuotaInfoUnlimited(): void { ->willReturnMap([ ['\OCA\Files_Sharing\SharedStorage', false], ['\OC\Files\Storage\Wrapper\Quota', false], + [\OCA\Files_Sharing\External\Storage::class, false], ]); $storage->expects($this->once()) @@ -341,6 +342,7 @@ public function testGetQuotaInfoSpecific(): void { ->willReturnMap([ ['\OCA\Files_Sharing\SharedStorage', false], ['\OC\Files\Storage\Wrapper\Quota', true], + [\OCA\Files_Sharing\External\Storage::class, false], ]); $storage->expects($this->once()) diff --git a/lib/private/legacy/OC_Helper.php b/lib/private/legacy/OC_Helper.php index 087ea3ef88b49..a89cbe1bb3a17 100644 --- a/lib/private/legacy/OC_Helper.php +++ b/lib/private/legacy/OC_Helper.php @@ -541,9 +541,16 @@ public static function getStorageInfo($path, $rootInfo = null, $includeMountPoin $relative = 0; } + /* + * \OCA\Files_Sharing\External\Storage returns the cloud ID as the owner for the storage. + * It is unnecessary to query the user manager for the display name, as it won't have this information. + */ + $isRemoteShare = $storage->instanceOfStorage(\OCA\Files_Sharing\External\Storage::class); + $ownerId = $storage->getOwner($path); $ownerDisplayName = ''; - if ($ownerId !== false) { + + if ($isRemoteShare === false && $ownerId !== false) { $ownerDisplayName = \OC::$server->getUserManager()->getDisplayName($ownerId) ?? ''; } @@ -565,7 +572,7 @@ public static function getStorageInfo($path, $rootInfo = null, $includeMountPoin 'mountPoint' => trim($mountPoint, '/'), ]; - if ($ownerId && $path === '/') { + if ($isRemoteShare === false && $ownerId !== false && $path === '/') { // If path is root, store this as last known quota usage for this user \OCP\Server::get(\OCP\IConfig::class)->setUserValue($ownerId, 'files', 'lastSeenQuotaUsage', (string)$relative); } From a601701a40252b90a01384322930cb368448b356 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 17 Mar 2025 11:28:55 +0100 Subject: [PATCH 2/5] ci: Update 3rdparty actions Signed-off-by: Joas Schilling --- 3rdparty | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/3rdparty b/3rdparty index 2b6d7bf65ff24..d8eb3e1e5164d 160000 --- a/3rdparty +++ b/3rdparty @@ -1 +1 @@ -Subproject commit 2b6d7bf65ff242ea050e736925f752a38d8da220 +Subproject commit d8eb3e1e5164dacdcb5962a475e67eb3f03043d4 From d7f885b1cb2244f74509786152b1eba1d2eb8f8a Mon Sep 17 00:00:00 2001 From: Luka Trovic Date: Wed, 29 Jan 2025 15:44:53 +0100 Subject: [PATCH 3/5] fix(files_sharing): skip expiration notify for invalid share record Signed-off-by: Luka Trovic --- apps/files_sharing/lib/Command/ExiprationNotification.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/files_sharing/lib/Command/ExiprationNotification.php b/apps/files_sharing/lib/Command/ExiprationNotification.php index df5656a434e63..b7ea5c5f14e92 100644 --- a/apps/files_sharing/lib/Command/ExiprationNotification.php +++ b/apps/files_sharing/lib/Command/ExiprationNotification.php @@ -8,6 +8,7 @@ */ namespace OCA\Files_Sharing\Command; +use OCA\Files_Sharing\OrphanHelper; use OCP\AppFramework\Utility\ITimeFactory; use OCP\IDBConnection; use OCP\Notification\IManager as NotificationManager; @@ -23,6 +24,7 @@ public function __construct( private NotificationManager $notificationManager, private IDBConnection $connection, private ShareManager $shareManager, + private OrphanHelper $orphanHelper, ) { parent::__construct(); } @@ -50,7 +52,8 @@ public function execute(InputInterface $input, OutputInterface $output): int { foreach ($shares as $share) { if ($share->getExpirationDate() === null || $share->getExpirationDate()->getTimestamp() < $minTime->getTimestamp() - || $share->getExpirationDate()->getTimestamp() > $maxTime->getTimestamp()) { + || $share->getExpirationDate()->getTimestamp() > $maxTime->getTimestamp() + || !$this->orphanHelper->isShareValid($share->getSharedBy(), $share->getNodeId())) { continue; } From f83d7bce52f4352dfb2a5dda59b9608f48fc41d7 Mon Sep 17 00:00:00 2001 From: Mauro Mura Date: Mon, 17 Mar 2025 14:23:37 +0100 Subject: [PATCH 4/5] introduced filter in move/copy action to remove files and encrypted folders from dialog --- apps/files/src/actions/moveOrCopyAction.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/apps/files/src/actions/moveOrCopyAction.ts b/apps/files/src/actions/moveOrCopyAction.ts index 724b65fa515ef..2cdfa8637e432 100644 --- a/apps/files/src/actions/moveOrCopyAction.ts +++ b/apps/files/src/actions/moveOrCopyAction.ts @@ -222,6 +222,12 @@ async function openFilePickerForAction( // We don't want to show the current nodes in the file picker return !fileIDs.includes(n.fileid) }) + .setFilter((n: Node) => { + // We only want to show folders in the file picker + // We don't want to show encrypted folders in the file picker + return n.type === FileType.File + && n.attributes?.['is-encrypted'] !== 1 + }) .setMimeTypeFilter([]) .setMultiSelect(false) .startAt(dir) From 123f961504bb12eeac67c62b94de5dce2d7b3b88 Mon Sep 17 00:00:00 2001 From: Mauro Mura Date: Tue, 18 Mar 2025 12:24:50 +0100 Subject: [PATCH 5/5] Update moveOrCopyAction.ts Check nodes for CREATE permission --- apps/files/src/actions/moveOrCopyAction.ts | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/apps/files/src/actions/moveOrCopyAction.ts b/apps/files/src/actions/moveOrCopyAction.ts index 2cdfa8637e432..52558240a8070 100644 --- a/apps/files/src/actions/moveOrCopyAction.ts +++ b/apps/files/src/actions/moveOrCopyAction.ts @@ -222,12 +222,7 @@ async function openFilePickerForAction( // We don't want to show the current nodes in the file picker return !fileIDs.includes(n.fileid) }) - .setFilter((n: Node) => { - // We only want to show folders in the file picker - // We don't want to show encrypted folders in the file picker - return n.type === FileType.File - && n.attributes?.['is-encrypted'] !== 1 - }) + .setFilter((n: Node) => (n.permissions & Permission.CREATE) === Permission.CREATE) .setMimeTypeFilter([]) .setMultiSelect(false) .startAt(dir)