diff options
author | Michael Gapczynski <mtgap@owncloud.com> | 2013-01-07 20:52:51 -0500 |
---|---|---|
committer | Michael Gapczynski <mtgap@owncloud.com> | 2013-01-07 20:52:51 -0500 |
commit | e8b195bf109d702402735e628b2d239b199088e5 (patch) | |
tree | 22d8920ea9ad18260b80d26848cd74928b269fd9 /apps/files_sharing/lib/share | |
parent | 8f8a5bbfb750b3c9091da810749a43cada2740b2 (diff) | |
download | nextcloud-server-e8b195bf109d702402735e628b2d239b199088e5.tar.gz nextcloud-server-e8b195bf109d702402735e628b2d239b199088e5.zip |
Almost fix Shared scanner...
Diffstat (limited to 'apps/files_sharing/lib/share')
-rw-r--r-- | apps/files_sharing/lib/share/file.php | 3 | ||||
-rw-r--r-- | apps/files_sharing/lib/share/folder.php | 11 |
2 files changed, 12 insertions, 2 deletions
diff --git a/apps/files_sharing/lib/share/file.php b/apps/files_sharing/lib/share/file.php index 5e98c455d35..6d3c55a008f 100644 --- a/apps/files_sharing/lib/share/file.php +++ b/apps/files_sharing/lib/share/file.php @@ -117,6 +117,9 @@ class OC_Share_Backend_File implements OCP\Share_Backend_File_Dependent { } public static function getSource($target) { + if ($target == '') { + return false; + } $target = '/'.$target; $target = rtrim($target, '/'); $pos = strpos($target, '/', 1); diff --git a/apps/files_sharing/lib/share/folder.php b/apps/files_sharing/lib/share/folder.php index bbe4c130bdd..11c8c6b1e80 100644 --- a/apps/files_sharing/lib/share/folder.php +++ b/apps/files_sharing/lib/share/folder.php @@ -24,6 +24,13 @@ class OC_Share_Backend_Folder extends OC_Share_Backend_File implements OCP\Share public function getChildren($itemSource) { $children = array(); $parents = array($itemSource); + $query = \OC_DB::prepare('SELECT `id` FROM `*PREFIX*mimetypes` WHERE `mimetype` = ?'); + $result = $query->execute(array('httpd/unix-directory')); + if ($row = $result->fetchRow()) { + $mimetype = $row['id']; + } else { + $mimetype = -1; + } while (!empty($parents)) { $parents = "'".implode("','", $parents)."'"; $query = OC_DB::prepare('SELECT `fileid`, `name`, `mimetype` FROM `*PREFIX*filecache` WHERE `parent` IN ('.$parents.')'); @@ -32,8 +39,8 @@ class OC_Share_Backend_Folder extends OC_Share_Backend_File implements OCP\Share while ($file = $result->fetchRow()) { $children[] = array('source' => $file['fileid'], 'file_path' => $file['name']); // If a child folder is found look inside it - if ($file['mimetype'] == 'httpd/unix-directory') { - $parents[] = $file['id']; + if ($file['mimetype'] == $mimetype) { + $parents[] = $file['fileid']; } } } |