mirror of
https://github.com/nextcloud/server.git
synced 2026-02-03 20:41:22 -05:00
fix(signed-request): use share owner on reshare
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
This commit is contained in:
parent
ac470184e7
commit
abd24f9bef
2 changed files with 9 additions and 3 deletions
|
|
@ -441,7 +441,7 @@ class RequestHandlerController extends Controller {
|
|||
return;
|
||||
}
|
||||
} elseif ($instance !== $signedRequest->getOrigin()) {
|
||||
throw new IncomingRequestException('remote instance {instance} not linked to origin {origin}', ['instance' => $instance, 'origin' => $signedRequest->getOrigin()]);
|
||||
throw new IncomingRequestException('remote instance ' . $instance . ' not linked to origin ' . $signedRequest->getOrigin());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -766,10 +766,16 @@ class CloudFederationProviderFiles implements ISignedCloudFederationProvider {
|
|||
$provider = $this->shareProviderFactory->getProviderForType(IShare::TYPE_REMOTE);
|
||||
try {
|
||||
$share = $provider->getShareByToken($sharedSecret);
|
||||
} catch (ShareNotFound $e) {
|
||||
} catch (ShareNotFound) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return $share->getSharedWith();
|
||||
// if uid_owner is a local account, the request comes from the recipient
|
||||
// if not, request comes from the instance that owns the share and recipient is the re-sharer
|
||||
if ($this->userManager->get($share->getShareOwner()) !== null) {
|
||||
return $share->getSharedWith();
|
||||
} else {
|
||||
return $share->getShareOwner();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue