summaryrefslogtreecommitdiffstats
path: root/lib/private/encryption
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@owncloud.com>2015-06-08 15:36:54 +0200
committerJoas Schilling <nickvergessen@owncloud.com>2015-06-08 15:42:38 +0200
commite6681857d2bb79adc8bed3c9a512fec2d4069c59 (patch)
tree02b688eb8df526d9ec47f976e956e789f78a7875 /lib/private/encryption
parent1769de0a6d6fcdfe2bb17d5dea42693055ed8a83 (diff)
downloadnextcloud-server-e6681857d2bb79adc8bed3c9a512fec2d4069c59.tar.gz
nextcloud-server-e6681857d2bb79adc8bed3c9a512fec2d4069c59.zip
Check if the part files has keys when the original file does not
Diffstat (limited to 'lib/private/encryption')
-rw-r--r--lib/private/encryption/keys/storage.php12
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/private/encryption/keys/storage.php b/lib/private/encryption/keys/storage.php
index fa317851a56..848d5c0134a 100644
--- a/lib/private/encryption/keys/storage.php
+++ b/lib/private/encryption/keys/storage.php
@@ -72,7 +72,17 @@ class Storage implements IStorage {
public function getFileKey($path, $keyId, $encryptionModuleId) {
$realFile = $this->util->stripPartialFileExtension($path);
$keyDir = $this->getFileKeyDir($encryptionModuleId, $realFile);
- return $this->getKey($keyDir . $keyId);
+ $key = $this->getKey($keyDir . $keyId);
+
+ if ($key === '' && $realFile !== $path) {
+ // Check if the part file has keys and use them, if no normal keys
+ // exist. This is required to fix copyBetweenStorage() when we
+ // rename a .part file over storage borders.
+ $keyDir = $this->getFileKeyDir($encryptionModuleId, $path);
+ $key = $this->getKey($keyDir . $keyId);
+ }
+
+ return $key;
}
/**