Skip to content

Commit

Permalink
use filesystem user instead of file owner for creating version
Browse files Browse the repository at this point in the history
Signed-off-by: Robin Appelman <robin@icewind.nl>
  • Loading branch information
icewind1991 committed Oct 3, 2022
1 parent a78956f commit d230c91
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 d230c91

Please sign in to comment.