Skip to content

Commit

Permalink
[Patch] Filter out deleted friles from shares list
Browse files Browse the repository at this point in the history
  • Loading branch information
nadir committed Apr 5, 2016
1 parent 2d333a8 commit 827618f
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions apps/files_sharing/api/customlocal.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'];
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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']);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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]);
Expand Down

0 comments on commit 827618f

Please sign in to comment.