summaryrefslogtreecommitdiffstats
path: root/apps/files_encryption/lib/stream.php
diff options
context:
space:
mode:
authorBjoern Schiessle <schiessle@owncloud.com>2013-11-21 00:23:38 +0100
committerBjoern Schiessle <schiessle@owncloud.com>2013-11-21 00:23:38 +0100
commitb27fc42e1f0fbd1edebb1eb1818de4b4e0c4ee4b (patch)
tree6e66949a72e8471a01817ff05851b65aec6ef8f0 /apps/files_encryption/lib/stream.php
parent318db64b2d9f724c3209bd6ca97f560840e2cc20 (diff)
downloadnextcloud-server-b27fc42e1f0fbd1edebb1eb1818de4b4e0c4ee4b.tar.gz
nextcloud-server-b27fc42e1f0fbd1edebb1eb1818de4b4e0c4ee4b.zip
public upload now also works with encryption enabled
Diffstat (limited to 'apps/files_encryption/lib/stream.php')
-rw-r--r--apps/files_encryption/lib/stream.php14
1 files changed, 7 insertions, 7 deletions
diff --git a/apps/files_encryption/lib/stream.php b/apps/files_encryption/lib/stream.php
index 2497e56e898..3fbcf7db3e4 100644
--- a/apps/files_encryption/lib/stream.php
+++ b/apps/files_encryption/lib/stream.php
@@ -90,11 +90,14 @@ class Stream {
$this->rootView = new \OC_FilesystemView('/');
}
+ // rawPath is relative to the data directory
+ $this->rawPath = \OC\Files\Filesystem::normalizePath(str_replace('crypt://', '', $path));
+
$this->session = new \OCA\Encryption\Session($this->rootView);
$this->privateKey = $this->session->getPrivateKey();
- $userId = Helper::getUser($path);
+ $userId = Helper::getUser($this->rawPath);
$util = new Util($this->rootView, $userId);
@@ -102,9 +105,6 @@ class Stream {
// public share key ID
$this->userId = $util->getUserId();
- // rawPath is relative to the data directory
- $this->rawPath = \OC\Files\Filesystem::normalizePath(str_replace('crypt://', '', $path));
-
// Strip identifier text from path, this gives us the path relative to data/<user>/files
$this->relPath = Helper::stripUserFilesPath($this->rawPath);
// if raw path doesn't point to a real file, check if it is a version or a file in the trash bin
@@ -518,7 +518,7 @@ class Stream {
$util = new Util($this->rootView, $userId);
// Get all users sharing the file includes current user
- $uniqueUserIds = $util->getSharingUsersArray($sharingEnabled, $this->relPath, $this->userId);
+ $uniqueUserIds = $util->getSharingUsersArray($sharingEnabled, $this->relPath, $userId);
$checkedUserIds = $util->filterShareReadyUsers($uniqueUserIds);
// Fetch public keys for all sharing users
@@ -528,10 +528,10 @@ class Stream {
$this->encKeyfiles = Crypt::multiKeyEncrypt($this->plainKey, $publicKeys);
// Save the new encrypted file key
- Keymanager::setFileKey($this->rootView, $this->relPath, $this->userId, $this->encKeyfiles['data']);
+ Keymanager::setFileKey($this->rootView, $util, $this->relPath, $userId, $this->encKeyfiles['data']);
// Save the sharekeys
- Keymanager::setShareKeys($this->rootView, $this->relPath, $this->encKeyfiles['keys']);
+ Keymanager::setShareKeys($this->rootView, $util, $this->relPath, $this->encKeyfiles['keys']);
// Re-enable proxy - our work is done
\OC_FileProxy::$enabled = $proxyStatus;