Merge pull request #22337 from owncloud/new_reshare_no_initiator

On backend hickups don't crash OCS output
This commit is contained in:
Thomas Müller 2016-02-15 12:02:52 +01:00
commit 46b39c3465
1 changed files with 4 additions and 4 deletions

View File

@ -91,14 +91,14 @@ class Share20OCS {
'id' => $share->getId(), 'id' => $share->getId(),
'share_type' => $share->getShareType(), 'share_type' => $share->getShareType(),
'uid_owner' => $share->getSharedBy(), 'uid_owner' => $share->getSharedBy(),
'displayname_owner' => $sharedBy->getDisplayName(), 'displayname_owner' => $sharedBy !== null ? $sharedBy->getDisplayName() : $share->getSharedBy(),
'permissions' => $share->getPermissions(), 'permissions' => $share->getPermissions(),
'stime' => $share->getShareTime()->getTimestamp(), 'stime' => $share->getShareTime()->getTimestamp(),
'parent' => null, 'parent' => null,
'expiration' => null, 'expiration' => null,
'token' => null, 'token' => null,
'uid_file_owner' => $share->getShareOwner(), 'uid_file_owner' => $share->getShareOwner(),
'displayname_file_owner' => $shareOwner->getDisplayName(), 'displayname_file_owner' => $shareOwner !== null ? $shareOwner->getDisplayName() : $share->getShareOwner(),
]; ];
$node = $share->getNode(); $node = $share->getNode();
@ -117,8 +117,8 @@ class Share20OCS {
if ($share->getShareType() === \OCP\Share::SHARE_TYPE_USER) { if ($share->getShareType() === \OCP\Share::SHARE_TYPE_USER) {
$sharedWith = $this->userManager->get($share->getSharedWith()); $sharedWith = $this->userManager->get($share->getSharedWith());
$result['share_with'] = $sharedWith->getUID(); $result['share_with'] = $share->getSharedWith();
$result['share_with_displayname'] = $sharedWith->getDisplayName(); $result['share_with_displayname'] = $sharedWith !== null ? $sharedWith->getDisplayName() : $share->getSharedWith();
} else if ($share->getShareType() === \OCP\Share::SHARE_TYPE_GROUP) { } else if ($share->getShareType() === \OCP\Share::SHARE_TYPE_GROUP) {
$result['share_with'] = $share->getSharedWith(); $result['share_with'] = $share->getSharedWith();
$result['share_with_displayname'] = $share->getSharedWith(); $result['share_with_displayname'] = $share->getSharedWith();