From 827618f7f60873cba90dace1254e6bfbedc52468 Mon Sep 17 00:00:00 2001 From: nadir Date: Tue, 5 Apr 2016 16:04:59 +0200 Subject: [PATCH] [Patch] Filter out deleted friles from shares list --- apps/files_sharing/api/customlocal.php | 29 ++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/apps/files_sharing/api/customlocal.php b/apps/files_sharing/api/customlocal.php index 98c0e9598910..888e970d7c51 100644 --- a/apps/files_sharing/api/customlocal.php +++ b/apps/files_sharing/api/customlocal.php @@ -85,6 +85,10 @@ public static function getShare($params) $eosMeta = EosUtil::getFileByEosPath($realfile); + if(strpos($eosMeta['eospath'], EosUtil::getEosRecycleDir()) !== FALSE) + { + return new \OC_OCS_Result(null, 404, 'the requested file has been deleted'); + } $row['path'] = substr(EosProxy::toOc($eosMeta['eospath']), 5); $row['file_target'] = $row['item_type'] === 'file' ? $eosMeta['name'] : "/" . $eosMeta['name']; @@ -237,6 +241,13 @@ private static function getAllFilesSharedByMe() unset($rows[$key]); continue; } + + if(strpos($eosMeta['eospath'], EosUtil::getEosRecycleDir()) !== FALSE) + { + unset($rows[$key]); + continue; + } + //$row['item_source'] = $eosMeta['fileid']; //$row['file_source'] = $eosMeta['fileid']; $row['path'] = substr(EosProxy::toOc($eosMeta['eospath']), 5); @@ -325,6 +336,13 @@ private static function getAllFilesSharedWithMe() unset($rows[$key]); continue; } + + if(strpos($eosMeta['eospath'], EosUtil::getEosRecycleDir()) !== FALSE) + { + unset($rows[$key]); + continue; + } + //$row['item_source'] = $eosMeta['fileid']; //$row['file_source'] = $eosMeta['fileid']; $row['path'] = EosProxy::toOc($eosMeta['eospath']); @@ -427,6 +445,12 @@ private static function getSharedFilesInFolder($path) $eosMeta = EosUtil::getFileByEosPath($realfile); + if(!$eosMeta || strpos($eosMeta['eospath'], EosUtil::getEosRecycleDir()) !== FALSE) + { + unset($rows[$key]); + continue; + } + //$row['item_source'] = $eosMeta['fileid']; // TESTING VERSION FILE ID //$row['file_source'] = $eosMeta['fileid']; // TESTING VERSION FILE ID $row['path'] = substr(EosProxy::toOc($eosMeta['eospath']), 5); @@ -483,6 +507,11 @@ private static function getSharedFileInfo($path) return new \OC_OCS_Result(null, 400, 'the file is not shared ' .$eosPath); } + if(strpos($eosMeta['eospath'], EosUtil::getEosRecycleDir()) !== FALSE) + { + return new \OC_OCS_Result(null, 404, 'the requested file has been deleted'); + } + // CACHE STORAGE ID $queryStorages = \OC_DB::prepare('SELECT numeric_id FROM oc_storages WHERE id = ?'); $resultStorages = $queryStorages->execute(['object::user:'.$username]);