The owner and recipient can also be null

If we have backend hickups it can be that we are unable to retrive the
owner and recipient user as well. In such cases just return the UID.
This commit is contained in:
Roeland Jago Douma 2016-02-12 10:44:34 +01:00
parent 0a33cdee0c
commit 479c458428
1 changed files with 3 additions and 3 deletions

View File

@ -98,7 +98,7 @@ class Share20OCS {
'expiration' => null,
'token' => null,
'uid_file_owner' => $share->getShareOwner(),
'displayname_file_owner' => $shareOwner->getDisplayName(),
'displayname_file_owner' => $shareOwner !== null ? $shareOwner->getDisplayName() : $share->getShareOwner(),
];
$node = $share->getNode();
@ -117,8 +117,8 @@ class Share20OCS {
if ($share->getShareType() === \OCP\Share::SHARE_TYPE_USER) {
$sharedWith = $this->userManager->get($share->getSharedWith());
$result['share_with'] = $sharedWith->getUID();
$result['share_with_displayname'] = $sharedWith->getDisplayName();
$result['share_with'] = $share->getSharedWith();
$result['share_with_displayname'] = $sharedWith !== null ? $sharedWith->getDisplayName() : $share->getSharedWith();
} else if ($share->getShareType() === \OCP\Share::SHARE_TYPE_GROUP) {
$result['share_with'] = $share->getSharedWith();
$result['share_with_displayname'] = $share->getSharedWith();