Merge pull request #55782 from nextcloud/backport/54950/stable30
Some checks failed
Integration sqlite / changes (push) Has been cancelled
Psalm static code analysis / static-code-analysis (push) Has been cancelled
Psalm static code analysis / static-code-analysis-security (push) Has been cancelled
Psalm static code analysis / static-code-analysis-ocp (push) Has been cancelled
Integration sqlite / integration-sqlite (8.1, stable30, --tags ~@large files_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.1, stable30, capabilities_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.1, stable30, collaboration_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.1, stable30, comments_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.1, stable30, dav_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.1, stable30, features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.1, stable30, federation_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.1, stable30, filesdrop_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.1, stable30, ldap_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.1, stable30, openldap_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.1, stable30, openldap_numerical_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.1, stable30, remoteapi_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.1, stable30, setup_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.1, stable30, sharees_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.1, stable30, sharing_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.1, stable30, theming_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.1, stable30, videoverification_features) (push) Has been cancelled
Integration sqlite / integration-sqlite-summary (push) Has been cancelled

[stable30] fix(files_trashbin): Fix size propagation when moving file to trash
This commit is contained in:
Julius Knorr 2025-10-31 15:34:23 +01:00 committed by GitHub
commit 225e0917d7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 24 additions and 1 deletions

View file

@ -287,8 +287,9 @@ class Trashbin {
try {
$moveSuccessful = true;
$inCache = $sourceStorage->getCache()->inCache($sourceInternalPath);
$trashStorage->moveFromStorage($sourceStorage, $sourceInternalPath, $trashInternalPath);
if ($sourceStorage->getCache()->inCache($sourceInternalPath)) {
if ($inCache) {
$trashStorage->getUpdater()->renameFromStorage($sourceStorage, $sourceInternalPath, $trashInternalPath);
}
} catch (\OCA\Files_Trashbin\Exceptions\CopyRecursiveException $e) {

View file

@ -653,6 +653,28 @@ class TrashbinTest extends \Test\TestCase {
}
}
public function testTrashSizePropagation(): void {
$view = new \OC\Files\View('/' . self::TEST_TRASHBIN_USER1 . '/files_trashbin/files');
$userFolder = \OCP\Server::get(\OCP\Files\IRootFolder::class)->getUserFolder(self::TEST_TRASHBIN_USER1);
$file1 = $userFolder->newFile('foo.txt');
$file1->putContent('1');
$this->assertTrue($userFolder->nodeExists('foo.txt'));
$file1->delete();
$this->assertFalse($userFolder->nodeExists('foo.txt'));
$this->assertEquals(1, $view->getFileInfo('')->getSize());
$folder = $userFolder->newFolder('bar');
$file2 = $folder->newFile('baz.txt');
$file2->putContent('22');
$this->assertTrue($userFolder->nodeExists('bar'));
$folder->delete();
$this->assertFalse($userFolder->nodeExists('bar'));
$this->assertEquals(3, $view->getFileInfo('')->getSize());
}
/**
* @param string $user
* @param bool $create