Skip to content
Snippets Groups Projects
Commit 9e08f85c authored by Björn Schießle's avatar Björn Schießle
Browse files

port already approved bugfix to master, https://github.com/owncloud/core/pull/1479

parent 2fdf8ff3
No related branches found
No related tags found
No related merge requests found
...@@ -721,6 +721,7 @@ class Share { ...@@ -721,6 +721,7 @@ class Share {
} }
$items = array(); $items = array();
$targets = array(); $targets = array();
$switchedItems = array();
while ($row = $result->fetchRow()) { while ($row = $result->fetchRow()) {
// Filter out duplicate group shares for users with unique targets // Filter out duplicate group shares for users with unique targets
if ($row['share_type'] == self::$shareTypeGroupUserUnique && isset($items[$row['parent']])) { if ($row['share_type'] == self::$shareTypeGroupUserUnique && isset($items[$row['parent']])) {
...@@ -745,6 +746,7 @@ class Share { ...@@ -745,6 +746,7 @@ class Share {
// Switch ids if sharing permission is granted on only one share to ensure correct parent is used if resharing // Switch ids if sharing permission is granted on only one share to ensure correct parent is used if resharing
if (~(int)$items[$id]['permissions'] & PERMISSION_SHARE && (int)$row['permissions'] & PERMISSION_SHARE) { if (~(int)$items[$id]['permissions'] & PERMISSION_SHARE && (int)$row['permissions'] & PERMISSION_SHARE) {
$items[$row['id']] = $items[$id]; $items[$row['id']] = $items[$id];
$switchedItems[$id] = $row['id'];
unset($items[$id]); unset($items[$id]);
$id = $row['id']; $id = $row['id'];
} }
...@@ -848,7 +850,11 @@ class Share { ...@@ -848,7 +850,11 @@ class Share {
} }
} }
// Remove collection item // Remove collection item
unset($items[$row['id']]); $toRemove = $row['id'];
if (array_key_exists($toRemove, $switchedItems)) {
$toRemove = $switchedItems[$toRemove];
}
unset($items[$toRemove]);
} }
} }
if (!empty($collectionItems)) { if (!empty($collectionItems)) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment