Make the file source path relative earlier

This commit is contained in:
Michael Gapczynski 2012-08-06 14:15:37 -04:00
parent e280e3ecc9
commit e954de6030

View file

@ -235,7 +235,7 @@ class Share {
* @return Returns true on success or false on failure
*/
public static function unshare($itemType, $itemSource, $shareType, $shareWith) {
if ($item = self::getItems($itemType, $itemSource, $shareType, $shareWith, \OC_User::getUser(), self::FORMAT_NONE, null, 1, false)) {
if ($item = self::getItems($itemType, $itemSource, $shareType, $shareWith, \OC_User::getUser(), self::FORMAT_NONE, null, 1)) {
self::delete($item['id']);
return true;
}
@ -524,6 +524,10 @@ class Share {
$result = $query->execute();
$items = array();
while ($row = $result->fetchRow()) {
// Remove root from file source paths
if (isset($uidOwner) && isset($row['file_source'])) {
$row['file_source'] = substr($row['file_source'], $root);
}
// Return only the item instead of a 2-dimensional array
if ($limit == 1 && $row['item_type'] == $itemType && $row[$column] == $item) {
if ($format == self::FORMAT_NONE) {
@ -538,10 +542,6 @@ class Share {
// Remove the parent group share
unset($items[$row['parent']]);
}
// Remove root from file source paths
if (isset($uidOwner) && isset($row['file_source'])) {
$row['file_source'] = substr($row['file_source'], $root);
}
// TODO Check this outside of the loop
// Check if this is a collection of the requested item type
if ($row['item_type'] != $itemType) {