From 73bab46758552a965450354d6407e328ab82d7f9 Mon Sep 17 00:00:00 2001 From: Michael Gapczynski Date: Fri, 8 Jul 2011 15:23:41 -0400 Subject: [PATCH] Prevent searching for user directory in getParentFolders() --- apps/files_sharing/lib_share.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/files_sharing/lib_share.php b/apps/files_sharing/lib_share.php index 50013aa711..72a8a39e57 100644 --- a/apps/files_sharing/lib_share.php +++ b/apps/files_sharing/lib_share.php @@ -148,8 +148,9 @@ class OC_SHARE { } else { $query = OC_DB::prepare("SELECT source FROM *PREFIX*sharing WHERE target = ? AND uid_shared_with = ? LIMIT 1"); } - // TODO Prevent searching for user directory e.g. '/MTGap/files' - while ($path != "" && $path != "/" && $path != ".") { + // Prevent searching for user directory e.g. '/MTGap/files' + $userDirectory = substr($path, 0, strpos($path, "files") + 5); + while ($path != "" && $path != "/" && $path != "." && $path != $userDirectory) { $result = $query->execute(array($path, $_SESSION['user_id']))->fetchAll(); if (count($result) > 0) { break;