Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable26] fix: Make sure that rollback hook is triggered on all version backends #37743

Merged
merged 4 commits into from
Apr 24, 2023

Conversation

backportbot-nextcloud[bot]
Copy link

backport of #36690

juliushaertl and others added 4 commits April 14, 2023 18:12
Signed-off-by: Robin Appelman <robin@icewind.nl>
Signed-off-by: Julius Härtl <jus@bitgrid.net>
$userFolder = $this->rootFolder->getUserFolder($user->getUID());
$nodes = $userFolder->getById($file->getId());
$file2 = array_pop($nodes);
$userFolder = $this->rootFolder->getUserFolder($user->getUID());

Check notice

Code scanning / Psalm

PossiblyNullReference

Cannot call method getUID on possibly null value
$versionEntity->setTimestamp($file2->getMTime());
$versionEntity->setSize($file2->getSize());
$versionEntity->setMimetype($this->mimeTypeLoader->getId($file2->getMimetype()));
$versionEntity->setFileId($file->getId());

Check notice

Code scanning / Psalm

PossiblyNullArgument

Argument 1 of setFileId cannot be null, possibly null value provided
$versionEntity->setMetadata([]);
$this->versionsMapper->insert($versionEntity);

// Insert entries in the DB for existing versions.
$versionsOnFS = Storage::getVersions($user->getUID(), $userFolder->getRelativePath($file2->getPath()));
$versionsOnFS = Storage::getVersions($user->getUID(), $userFolder->getRelativePath($file->getPath()));

Check notice

Code scanning / Psalm

PossiblyUndefinedVariable

Possibly undefined variable $userFolder, first seen on line 73
foreach ($versionsOnFS as $version) {
$versionEntity = new VersionEntity();
$versionEntity->setFileId($file2->getId());
$versionEntity->setFileId($file->getId());

Check notice

Code scanning / Psalm

PossiblyNullArgument

Argument 1 of setFileId cannot be null, possibly null value provided
$nodes = $userFolder->getById($file->getId());
$file2 = array_pop($nodes);
$userFolder = $this->rootFolder->getUserFolder($user->getUID());
$nodes = $userFolder->getById($file->getId());

Check notice

Code scanning / Psalm

PossiblyNullArgument

Argument 1 of OCP\Files\Folder::getById cannot be null, possibly null value provided
@skjnldsv skjnldsv mentioned this pull request Apr 18, 2023
9 tasks
@juliushaertl juliushaertl merged commit b7d3942 into stable26 Apr 24, 2023
@juliushaertl juliushaertl deleted the backport/36690/stable26 branch April 24, 2023 10:27
@blizzz blizzz mentioned this pull request May 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants