Problems with federated shares and permissions/resharing

gnarf… if you’re not doing it yourself…

digging into code. file Manager.php in /nextcloud_dir/lib/private/share20. Line #325 (first not sure by error-code, but yes, it’s the line number.

here it fails:

// Check that we do not share with more permissions than we have if ($share->getPermissions() & [b]~$permissions[/b]) { $message_t = $this->l->t('Can’t increase permissions of %s', [$share->getNode()->getPath()]); throw new GenericShareException($message_t, $message_t, 404); }

looking through functions above. in the first part of the if clause it seems to be possible, that there is no variable called “$permissions” defined. it seems to be true, if $incomingShares is empty. so i added a little bit modified if clause there.

old:

/** @var \OCP\Share\IShare[] $incomingShares */ if (!empty($incomingShares)) { $permissions = 0; foreach ($incomingShares as $incomingShare) { $permissions |= $incomingShare->getPermissions(); } }

modified:

/** @var \OCP\Share\IShare[] $incomingShares */ if (empty($incomingShares)) { //leer? dann vom share selbst versuchen auszulesen $permissions = $share->getNode()->getPermissions(); } else { $permissions = 0; foreach ($incomingShares as $incomingShare) { $permissions |= $incomingShare->getPermissions(); } }

now it works.

cya v3g0

3d1t: your bb-code interpreter seems to be crappy/buggy…