Skip to content

Commit 307608b

Browse files
authored
Merge pull request #47346 from nextcloud/encryption-key-copy-mountpoint
2 parents 560282a + 3756152 commit 307608b

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

lib/private/Files/SetupManager.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,9 @@ private function setupBuiltinWrappers() {
107107
$prevLogging = Filesystem::logWarningWhenAddingStorageWrapper(false);
108108

109109
Filesystem::addStorageWrapper('mount_options', function ($mountPoint, IStorage $storage, IMountPoint $mount) {
110-
if ($mount->getOptions() && $storage->instanceOfStorage(Common::class)) {
111-
$storage->setMountOptions($mount->getOptions());
110+
if ($storage->instanceOfStorage(Common::class)) {
111+
$options = array_merge($mount->getOptions(), ['mount_point' => $mountPoint]);
112+
$storage->setMountOptions($options);
112113
}
113114
return $storage;
114115
});

lib/private/Files/Storage/Wrapper/Encryption.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use OC\Files\Filesystem;
1515
use OC\Files\Mount\Manager;
1616
use OC\Files\ObjectStore\ObjectStoreStorage;
17+
use OC\Files\Storage\Common;
1718
use OC\Files\Storage\LocalTempFileTrait;
1819
use OC\Memcache\ArrayCache;
1920
use OCP\Cache\CappedMemoryCache;
@@ -776,9 +777,8 @@ private function copyBetweenStorage(
776777

777778
// first copy the keys that we reuse the existing file key on the target location
778779
// and don't create a new one which would break versions for example.
779-
$mount = $this->mountManager->findByStorageId($sourceStorage->getId());
780-
if (count($mount) >= 1) {
781-
$mountPoint = $mount[0]->getMountPoint();
780+
if ($sourceStorage->instanceOfStorage(Common::class) && $sourceStorage->getMountOption('mount_point')) {
781+
$mountPoint = $sourceStorage->getMountOption('mount_point');
782782
$source = $mountPoint . '/' . $sourceInternalPath;
783783
$target = $this->getFullPath($targetInternalPath);
784784
$this->copyKeys($source, $target);

0 commit comments

Comments
 (0)