From 3d13c9db700522854a2fd6e4af624b921f062c8f Mon Sep 17 00:00:00 2001 From: Michael Gapczynski Date: Mon, 5 Nov 2012 17:54:23 -0500 Subject: [PATCH] Return empty array if file does not exist inside Shared folder, fixes issue #91 --- lib/files.php | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/lib/files.php b/lib/files.php index 5a14083c2855..3e15c68d8851 100644 --- a/lib/files.php +++ b/lib/files.php @@ -45,13 +45,16 @@ public static function getFileInfo($path) { 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);