]> source.dussan.org Git - nextcloud-server.git/commitdiff
use filesystem user instead of file owner for creating version 34001/head
authorRobin Appelman <robin@icewind.nl>
Fri, 9 Sep 2022 14:21:46 +0000 (16:21 +0200)
committerRobin Appelman <robin@icewind.nl>
Fri, 9 Sep 2022 14:22:40 +0000 (16:22 +0200)
Signed-off-by: Robin Appelman <robin@icewind.nl>
apps/files_versions/lib/Storage.php

index 4673b4850fa214815ac95bdab167a8d2220d745d..e314eddb9458175a31ba02712d1f676272dba23e 100644 (file)
@@ -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);
        }