summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorBjörn Schießle <bjoern@schiessle.org>2016-06-30 17:17:21 +0200
committerGitHub <noreply@github.com>2016-06-30 17:17:21 +0200
commiteed6c6a8b9a17e2eb290b9db76ebdbb8429336b1 (patch)
treecee659edf454442190f0dc497e449da3894e24c1 /lib
parentd52343fc4e28af8c22b8fd0af1d7488ab56cb736 (diff)
parent347787d92c9f5f0e50bb87aa78d3fe692c88003f (diff)
downloadnextcloud-server-eed6c6a8b9a17e2eb290b9db76ebdbb8429336b1.tar.gz
nextcloud-server-eed6c6a8b9a17e2eb290b9db76ebdbb8429336b1.zip
Merge pull request #266 from nextcloud/fix-262
[stable9] getShareByToken() should also consider remote shares
Diffstat (limited to 'lib')
-rw-r--r--lib/private/share20/manager.php12
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/private/share20/manager.php b/lib/private/share20/manager.php
index 5d53d0ef839..e7dafb2a0c3 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()) {