Skip to content

Commit

Permalink
Merge pull request #34040 from nextcloud/backport/34001/stable24
Browse files Browse the repository at this point in the history
  • Loading branch information
skjnldsv authored Oct 27, 2022
2 parents f4a3168 + d230c91 commit 986c9c7
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion apps/files_versions/lib/Storage.php
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,18 @@ public static function store($filename) {
$ownerNodes = $ownerFolder->getById($file->getId());
if (count($ownerNodes)) {
$file = current($ownerNodes);
$uid = $mount->getShare()->getShareOwner();
}
}

/** @var IUserManager $userManager */
$userManager = \OC::$server->get(IUserManager::class);
$user = $userManager->get($uid);

if (!$user) {
return false;
}

// no use making versions for empty files
if ($file->getSize() === 0) {
return false;
Expand All @@ -227,7 +236,7 @@ public static function store($filename) {
/** @var IVersionManager $versionManager */
$versionManager = \OC::$server->get(IVersionManager::class);

$versionManager->createVersion($file->getOwner(), $file);
$versionManager->createVersion($user, $file);
}


Expand Down

0 comments on commit 986c9c7

Please sign in to comment.