Skip to content

Commit

Permalink
Fix array access in FederatedShareProvider
Browse files Browse the repository at this point in the history
  • Loading branch information
VicDeo committed Apr 27, 2020
1 parent 0559c10 commit 6989b2f
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions apps/federatedfilesharing/lib/FederatedShareProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ protected function createFederatedShare(IShare $share) {
$ownerAddress = $this->addressHandler->getLocalUserFederatedAddress($owner);
$sharedWith = $share->getSharedWith();
$shareWithAddress = new Address($sharedWith);
$status = $this->notifications->sendRemoteShare(
$result = $this->notifications->sendRemoteShare(
$shareWithAddress,
$ownerAddress,
$sharedByAddress,
Expand All @@ -252,8 +252,16 @@ protected function createFederatedShare(IShare $share) {
/* Check for failure or null return from sending and pick up an error message
* if there is one coming from the remote server, otherwise use a generic one.
*/
if (!$status || $status['ocs']['meta']['status'] === 'failure') {
$msg = $status['ocs']['meta']['message'] ?? false;
if (\is_bool($result)) {
$status = $result;
} elseif (isset($result['ocs']['meta']['status'])) {
$status = $result['ocs']['meta']['status'];
} else {
$status = false;
}

if ($status === false) {
$msg = $result['ocs']['meta']['message'] ?? false;
if (!$msg) {
$message_t = $this->l->t('Sharing %s failed, could not find %s, maybe the server is currently unreachable.',
[$share->getNode()->getName(), $share->getSharedWith()]);
Expand Down

0 comments on commit 6989b2f

Please sign in to comment.