From ea54fe98f729f371cfaec983d53d4c5d385a41c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Schie=C3=9Fle?= Date: Tue, 20 Nov 2012 16:57:35 +0100 Subject: [PATCH] take root folder into account while checking for Shared folder --- lib/filecache.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/filecache.php b/lib/filecache.php index 50990c332be..abdf6c6c86c 100644 --- a/lib/filecache.php +++ b/lib/filecache.php @@ -520,11 +520,15 @@ class OC_FileCache{ * @return array with the path and the root of the give file */ private static function getSourcePathOfSharedFile($path, $root) { - if ( OC_App::isEnabled('files_sharing') && !strncmp($path, '/Shared/', 8)) { - $source = OC_Files_Sharing_Util::getSourcePath(str_replace('/Shared/', '', $path)); - $parts = explode('/', $source, 4); - $root = '/'.$parts[1].'/files'; - $path = '/'.$parts[3]; + if ( OC_App::isEnabled('files_sharing')) { + $fullPath = OC_Filesystem::normalizePath($root.'/'.$path); + $sharedPos = strpos($fullPath, '/Shared/'); + if ( $sharedPos !== false && ($source = OC_Files_Sharing_Util::getSourcePath(substr($fullPath, $sharedPos+8))) ) { + $source = OC_Files_Sharing_Util::getSourcePath(str_replace('/Shared/', '', $path)); + $parts = explode('/', $source, 4); + $root = '/'.$parts[1].'/files'; + $path = '/'.$parts[3]; + } } return array($path, $root);