diff options
author | blizzz <blizzz@arthur-schiwon.de> | 2022-09-12 18:37:02 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-12 18:37:02 +0200 |
commit | a1fcee0c99d52c1fd11c11dc178edbff60aa08ed (patch) | |
tree | 13fe92fb3901283a8907dc738d0ae46bfe4c8e8b | |
parent | b9eef6f2ff54556c5b81fa60899da5739858a477 (diff) | |
parent | 9587a4a548c1065273c70546356a45ca2778afd4 (diff) | |
download | nextcloud-server-a1fcee0c99d52c1fd11c11dc178edbff60aa08ed.tar.gz nextcloud-server-a1fcee0c99d52c1fd11c11dc178edbff60aa08ed.zip |
Merge pull request #34001 from nextcloud/versions-create-user
use filesystem user instead of file owner for creating version
-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); } |