diff --git a/apps/files_sharing/lib_share.php b/apps/files_sharing/lib_share.php
index 356c958b6ceba36ae021522943bd0fc917c1a501..31170f07fd1251d81cbac77a946272d01c849747 100644
--- a/apps/files_sharing/lib_share.php
+++ b/apps/files_sharing/lib_share.php
@@ -276,7 +276,7 @@ class OC_Share {
 		$userDirectory = substr($target, 0, strpos($target, "files") + 5);
 		$target = dirname($target);
 		$result = array();
-		while ($target != "" && $target != "/" && $target != "." && $target != $userDirectory) {
+		while ($target != "" && $target != "/" && $target != "." && $target != $userDirectory && $target != "\\") {
 			// Check if the parent directory of this target location is shared
 			$result = $query->execute(array($target))->fetchAll();
 			if (count($result) > 0) {