]> source.dussan.org Git - nextcloud-server.git/commitdiff
Return empty array if file does not exist inside Shared folder, fixes issue #91
authorMichael Gapczynski <mtgap@owncloud.com>
Mon, 5 Nov 2012 22:54:23 +0000 (17:54 -0500)
committerMichael Gapczynski <mtgap@owncloud.com>
Wed, 7 Nov 2012 22:15:09 +0000 (17:15 -0500)
lib/files.php

index f58f74f7674979f3e0146de47fec3a14fcb39f6e..d96e9dfabc4ca12c9c6f7e039ecf473fee56fe96 100644 (file)
@@ -46,13 +46,16 @@ class OC_Files {
                if (($path == '/Shared' || substr($path, 0, 8) == '/Shared/') && OC_App::isEnabled('files_sharing')) {
                        if ($path == '/Shared') {
                                list($info) = OCP\Share::getItemsSharedWith('file', OC_Share_Backend_File::FORMAT_FILE_APP_ROOT);
-                       }else{
-                               $info['size'] = OC_Filesystem::filesize($path);
-                               $info['mtime'] = OC_Filesystem::filemtime($path);
-                               $info['ctime'] = OC_Filesystem::filectime($path);
-                               $info['mimetype'] = OC_Filesystem::getMimeType($path);
-                               $info['encrypted'] = false;
-                               $info['versioned'] = false;
+                       } else {
+                               $info = array();
+                               if (OC_Filesystem::file_exists($path)) {
+                                       $info['size'] = OC_Filesystem::filesize($path);
+                                       $info['mtime'] = OC_Filesystem::filemtime($path);
+                                       $info['ctime'] = OC_Filesystem::filectime($path);
+                                       $info['mimetype'] = OC_Filesystem::getMimeType($path);
+                                       $info['encrypted'] = false;
+                                       $info['versioned'] = false;
+                               }
                        }
                } else {
                        $info = OC_FileCache::get($path);