getShareByToken() should also consider remote shares

This commit is contained in:
Bjoern Schiessle 2016-06-30 16:32:37 +02:00
parent 29929c9728
commit 347787d92c
No known key found for this signature in database
GPG Key ID: 2378A753E2BF04F6
1 changed files with 11 additions and 1 deletions

View File

@ -986,7 +986,17 @@ class Manager implements IManager {
public function getShareByToken($token) {
$provider = $this->factory->getProviderForType(\OCP\Share::SHARE_TYPE_LINK);
$share = $provider->getShareByToken($token);
try {
$share = $provider->getShareByToken($token);
} catch (ShareNotFound $e) {
//Ignore
}
// If it is not a link share try to fetch a federated share by token
if ($share === null) {
$provider = $this->factory->getProviderForType(\OCP\Share::SHARE_TYPE_REMOTE);
$share = $provider->getShareByToken($token);
}
if ($share->getExpirationDate() !== null &&
$share->getExpirationDate() <= new \DateTime()) {