diff options
author | John Molakvoæ <skjnldsv@users.noreply.github.com> | 2024-08-20 16:16:08 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-20 16:16:08 +0200 |
commit | 307608b26cc0492eda5657bf674ec634523a63ee (patch) | |
tree | d2417d971edff58c89a628861efa1d351c34d9b4 | |
parent | 560282a47bf3f9dca4653f89d530a6e1dd144f5f (diff) | |
parent | 3756152cb15d849457de6631c32758aa982e0a5f (diff) | |
download | nextcloud-server-307608b26cc0492eda5657bf674ec634523a63ee.tar.gz nextcloud-server-307608b26cc0492eda5657bf674ec634523a63ee.zip |
Merge pull request #47346 from nextcloud/encryption-key-copy-mountpoint
-rw-r--r-- | lib/private/Files/SetupManager.php | 5 | ||||
-rw-r--r-- | lib/private/Files/Storage/Wrapper/Encryption.php | 6 |
2 files changed, 6 insertions, 5 deletions
diff --git a/lib/private/Files/SetupManager.php b/lib/private/Files/SetupManager.php index 53befe57e36..3a3f7ba9c11 100644 --- a/lib/private/Files/SetupManager.php +++ b/lib/private/Files/SetupManager.php @@ -107,8 +107,9 @@ class SetupManager { $prevLogging = Filesystem::logWarningWhenAddingStorageWrapper(false); Filesystem::addStorageWrapper('mount_options', function ($mountPoint, IStorage $storage, IMountPoint $mount) { - if ($mount->getOptions() && $storage->instanceOfStorage(Common::class)) { - $storage->setMountOptions($mount->getOptions()); + if ($storage->instanceOfStorage(Common::class)) { + $options = array_merge($mount->getOptions(), ['mount_point' => $mountPoint]); + $storage->setMountOptions($options); } return $storage; }); diff --git a/lib/private/Files/Storage/Wrapper/Encryption.php b/lib/private/Files/Storage/Wrapper/Encryption.php index 7d45c356bfe..09048c239ee 100644 --- a/lib/private/Files/Storage/Wrapper/Encryption.php +++ b/lib/private/Files/Storage/Wrapper/Encryption.php @@ -14,6 +14,7 @@ use OC\Files\Cache\CacheEntry; use OC\Files\Filesystem; use OC\Files\Mount\Manager; use OC\Files\ObjectStore\ObjectStoreStorage; +use OC\Files\Storage\Common; use OC\Files\Storage\LocalTempFileTrait; use OC\Memcache\ArrayCache; use OCP\Cache\CappedMemoryCache; @@ -776,9 +777,8 @@ class Encryption extends Wrapper { // first copy the keys that we reuse the existing file key on the target location // and don't create a new one which would break versions for example. - $mount = $this->mountManager->findByStorageId($sourceStorage->getId()); - if (count($mount) >= 1) { - $mountPoint = $mount[0]->getMountPoint(); + if ($sourceStorage->instanceOfStorage(Common::class) && $sourceStorage->getMountOption('mount_point')) { + $mountPoint = $sourceStorage->getMountOption('mount_point'); $source = $mountPoint . '/' . $sourceInternalPath; $target = $this->getFullPath($targetInternalPath); $this->copyKeys($source, $target); |