Merge pull request #266 from nextcloud/fix-262
[stable9] getShareByToken() should also consider remote shares
This commit is contained in:
commit
eed6c6a8b9
|
@ -986,7 +986,17 @@ class Manager implements IManager {
|
||||||
public function getShareByToken($token) {
|
public function getShareByToken($token) {
|
||||||
$provider = $this->factory->getProviderForType(\OCP\Share::SHARE_TYPE_LINK);
|
$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 &&
|
if ($share->getExpirationDate() !== null &&
|
||||||
$share->getExpirationDate() <= new \DateTime()) {
|
$share->getExpirationDate() <= new \DateTime()) {
|
||||||
|
|
Loading…
Reference in New Issue