From d4085d81485c3d973faf4211e11af1c1853e619c Mon Sep 17 00:00:00 2001
From: Bjoern Schiessle <schiessle@owncloud.com>
Date: Fri, 11 Apr 2014 11:18:50 +0200
Subject: [PATCH] make sure that path is not 'false'

---
 apps/files_sharing/lib/cache.php         | 6 +++---
 apps/files_sharing/lib/sharedstorage.php | 4 +---
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/apps/files_sharing/lib/cache.php b/apps/files_sharing/lib/cache.php
index e91c15cc62..11f180bf7e 100644
--- a/apps/files_sharing/lib/cache.php
+++ b/apps/files_sharing/lib/cache.php
@@ -169,9 +169,8 @@ class Shared_Cache extends Cache {
 	 * @return int file id
 	 */
 	public function put($file, array $data) {
-		if ($file === '' && isset($data['etag'])) {
-			return \OCP\Config::setUserValue(\OCP\User::getUser(), 'files_sharing', 'etag', $data['etag']);
-		} else if ($cache = $this->getSourceCache($file)) {
+		$file = ($file === false) ? '' : $file;
+		if ($cache = $this->getSourceCache($file)) {
 			return $cache->put($this->files[$file], $data);
 		}
 		return false;
@@ -368,6 +367,7 @@ class Shared_Cache extends Cache {
 	 * @return int
 	 */
 	public function calculateFolderSize($path, $entry = null) {
+		$path = ($path === false) ? '' : $path;
 		if ($cache = $this->getSourceCache($path)) {
 			return $cache->calculateFolderSize($this->files[$path]);
 		}
diff --git a/apps/files_sharing/lib/sharedstorage.php b/apps/files_sharing/lib/sharedstorage.php
index 3a31e96554..8254f0e05c 100644
--- a/apps/files_sharing/lib/sharedstorage.php
+++ b/apps/files_sharing/lib/sharedstorage.php
@@ -272,9 +272,7 @@ class Shared extends \OC\Files\Storage\Common {
 
 	public function unlink($path) {
 		// Delete the file if DELETE permission is granted
-		if ($path == '') {
-			$path = $this->mountPoint;
-		}
+		$path = ($path === false) ? '' : $path;
 		if ($source = $this->getSourcePath($path)) {
 			if ($this->isDeletable($path)) {
 				list($storage, $internalPath) = \OC\Files\Filesystem::resolvePath($source);
-- 
GitLab