diff options
author | Robin Appelman <robin@icewind.nl> | 2022-09-09 16:21:46 +0200 |
---|---|---|
committer | Robin Appelman <robin@icewind.nl> | 2022-09-09 16:22:40 +0200 |
commit | 9587a4a548c1065273c70546356a45ca2778afd4 (patch) | |
tree | 85915531a47dace351be3e8e73ff2ac7361c5621 /apps | |
parent | 92258567d4df832f714fb15a6db975152be8220b (diff) | |
download | nextcloud-server-9587a4a548c1065273c70546356a45ca2778afd4.tar.gz nextcloud-server-9587a4a548c1065273c70546356a45ca2778afd4.zip |
use filesystem user instead of file owner for creating version
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files_versions/lib/Storage.php | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/apps/files_versions/lib/Storage.php b/apps/files_versions/lib/Storage.php index 4673b4850fa..e314eddb945 100644 --- a/apps/files_versions/lib/Storage.php +++ b/apps/files_versions/lib/Storage.php @@ -210,9 +210,18 @@ class Storage { $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; @@ -227,7 +236,7 @@ class Storage { /** @var IVersionManager $versionManager */ $versionManager = \OC::$server->get(IVersionManager::class); - $versionManager->createVersion($file->getOwner(), $file); + $versionManager->createVersion($user, $file); } |