Correct checking item source for share from same owner when generating item target

This commit is contained in:
Michael Gapczynski 2012-10-02 16:37:39 -04:00
parent 431d92e7b2
commit 68c8faf39c
1 changed files with 1242 additions and 1241 deletions

View File

@ -975,8 +975,10 @@ class Share {
} else { } else {
if ($itemType == 'file' || $itemType == 'folder') { if ($itemType == 'file' || $itemType == 'folder') {
$column = 'file_target'; $column = 'file_target';
$columnSource = 'file_source';
} else { } else {
$column = 'item_target'; $column = 'item_target';
$columnSource = 'item_source';
} }
if ($shareType == self::SHARE_TYPE_USER) { if ($shareType == self::SHARE_TYPE_USER) {
// Share with is a user, so set share type to user and groups // Share with is a user, so set share type to user and groups
@ -1003,8 +1005,7 @@ class Share {
} }
// Check if target already exists // Check if target already exists
$checkTarget = self::getItems($itemType, $target, $shareType, $shareWith); $checkTarget = self::getItems($itemType, $target, $shareType, $shareWith);
if (!empty($checkTarget)) {
if ( !empty($checkTarget) ) {
foreach ($checkTarget as $item) { foreach ($checkTarget as $item) {
// Skip item if it is the group parent row // Skip item if it is the group parent row
if (isset($groupParent) && $item['id'] == $groupParent) { if (isset($groupParent) && $item['id'] == $groupParent) {
@ -1014,7 +1015,7 @@ class Share {
continue; continue;
} }
} }
if ($item['uid_owner'] == $uidOwner && $item['item_source'] == \OC_FileCache::getId($itemSource) ) { if ($item['uid_owner'] == $uidOwner && $item[$columnSource] == $itemSource) {
return $target; return $target;
} }
} }