From 99255ff3a92b2d242f3c723979341951a303f83d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thomas=20M=C3=BCller?= <thomas.mueller@tmit.eu>
Date: Mon, 30 Mar 2015 21:44:28 +0200
Subject: [PATCH] Fix - public sharing: in case on user is available - get it
 from the path

---
 lib/private/files/storage/wrapper/encryption.php | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/lib/private/files/storage/wrapper/encryption.php b/lib/private/files/storage/wrapper/encryption.php
index 8892194f32b..cea7a38d41b 100644
--- a/lib/private/files/storage/wrapper/encryption.php
+++ b/lib/private/files/storage/wrapper/encryption.php
@@ -244,8 +244,13 @@ class Encryption extends Wrapper {
 
 		if($shouldEncrypt === true && !$this->util->isExcluded($fullPath) && $encryptionModule !== null) {
 			$source = $this->storage->fopen($path, $mode);
+			$uid = $this->uid;
+			if (is_null($uid)) {
+				list($owner, ) = $this->util->getUidAndFilename($fullPath);
+				$uid = $owner;
+			}
 			$handle = \OC\Files\Stream\Encryption::wrap($source, $path, $fullPath, $header,
-				$this->uid, $encryptionModule, $this->storage, $this, $this->util, $mode,
+				$uid, $encryptionModule, $this->storage, $this, $this->util, $mode,
 				$size, $unencryptedSize);
 			return $handle;
 		} else {
-- 
GitLab