Merge pull request #266 from nextcloud/fix-262

[stable9] getShareByToken() should also consider remote shares
This commit is contained in:
Björn Schießle 2016-06-30 17:17:21 +02:00 committed by GitHub
commit eed6c6a8b9
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()) {