summaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/lib
diff options
context:
space:
mode:
authorLukas Reschke <lukas@owncloud.com>2016-07-01 11:36:35 +0200
committerLukas Reschke <lukas@owncloud.com>2016-07-01 11:36:35 +0200
commit179a355b2cd3dc489a54cc27fd717f67373d0b1e (patch)
treef87a5586086635d4cbd18771b442ee771f79e441 /apps/files_sharing/lib
parent8e002b61554308cb4d50570f715303a82136f0fa (diff)
parent2d2d2267f7f38ca29e7b87f40fae62261614b0d1 (diff)
downloadnextcloud-server-179a355b2cd3dc489a54cc27fd717f67373d0b1e.tar.gz
nextcloud-server-179a355b2cd3dc489a54cc27fd717f67373d0b1e.zip
Merge remote-tracking branch 'upstream/master' into master-sync-upstream
Diffstat (limited to 'apps/files_sharing/lib')
-rw-r--r--apps/files_sharing/lib/External/Manager.php2
-rw-r--r--apps/files_sharing/lib/External/Storage.php19
2 files changed, 18 insertions, 3 deletions
diff --git a/apps/files_sharing/lib/External/Manager.php b/apps/files_sharing/lib/External/Manager.php
index e338e6e509c..3f665b0978d 100644
--- a/apps/files_sharing/lib/External/Manager.php
+++ b/apps/files_sharing/lib/External/Manager.php
@@ -328,7 +328,7 @@ class Manager {
public function removeShare($mountPoint) {
$mountPointObj = $this->mountManager->find($mountPoint);
- $id = $mountPointObj->getStorage()->getCache()->getId();
+ $id = $mountPointObj->getStorage()->getCache()->getId('');
$mountPoint = $this->stripPath($mountPoint);
$hash = md5($mountPoint);
diff --git a/apps/files_sharing/lib/External/Storage.php b/apps/files_sharing/lib/External/Storage.php
index 29b9c7b563c..bc8d898f8ef 100644
--- a/apps/files_sharing/lib/External/Storage.php
+++ b/apps/files_sharing/lib/External/Storage.php
@@ -32,6 +32,7 @@ use OC\Files\Storage\DAV;
use OC\ForbiddenException;
use OCA\FederatedFileSharing\DiscoveryManager;
use OCA\Files_Sharing\ISharedStorage;
+use OCP\AppFramework\Http;
use OCP\Files\NotFoundException;
use OCP\Files\StorageInvalidException;
use OCP\Files\StorageNotAvailableException;
@@ -181,6 +182,20 @@ class Storage extends DAV implements ISharedStorage {
}
}
+ public function test() {
+ try {
+ parent::test();
+ } catch (StorageInvalidException $e) {
+ // check if it needs to be removed
+ $this->checkStorageAvailability();
+ throw $e;
+ } catch (StorageNotAvailableException $e) {
+ // check if it needs to be removed or just temp unavailable
+ $this->checkStorageAvailability();
+ throw $e;
+ }
+ }
+
/**
* Check whether this storage is permanently or temporarily
* unavailable
@@ -310,10 +325,10 @@ class Storage extends DAV implements ISharedStorage {
'connect_timeout' => 10,
]);
} catch (\GuzzleHttp\Exception\RequestException $e) {
- if ($e->getCode() === 401 || $e->getCode() === 403) {
+ if ($e->getCode() === Http::STATUS_UNAUTHORIZED || $e->getCode() === Http::STATUS_FORBIDDEN) {
throw new ForbiddenException();
}
- if ($e->getCode() === 404) {
+ if ($e->getCode() === Http::STATUS_NOT_FOUND) {
throw new NotFoundException();
}
// throw this to be on the safe side: the share will still be visible