From 347787d92c9f5f0e50bb87aa78d3fe692c88003f Mon Sep 17 00:00:00 2001 From: Bjoern Schiessle Date: Thu, 30 Jun 2016 16:32:37 +0200 Subject: [PATCH] getShareByToken() should also consider remote shares --- lib/private/share20/manager.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/private/share20/manager.php b/lib/private/share20/manager.php index 5d53d0ef83..e7dafb2a0c 100644 --- a/lib/private/share20/manager.php +++ b/lib/private/share20/manager.php @@ -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()) {