Skip to content

Conversation

@backportbot-nextcloud
Copy link

backport of #36690

$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

// 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
@juliusknorr juliusknorr merged commit b7d3942 into stable26 Apr 24, 2023
@juliusknorr juliusknorr 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.

5 participants