summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2014-07-01 14:58:07 +0200
committerRobin Appelman <icewind@owncloud.com>2014-07-01 14:58:07 +0200
commit8061a4ccc09bbd6ba675521d1f9e2ced396c862f (patch)
tree9c23d232de2e71e88b4ab4b284aeeaa4a2133b27
parent1c43081d3819ab360fad3f44b6cf2cd8d2cf25a9 (diff)
downloadnextcloud-server-8061a4ccc09bbd6ba675521d1f9e2ced396c862f.tar.gz
nextcloud-server-8061a4ccc09bbd6ba675521d1f9e2ced396c862f.zip
Remove external shares if the share is invalid
-rw-r--r--apps/files_sharing/lib/external/manager.php2
-rw-r--r--apps/files_sharing/lib/external/storage.php9
2 files changed, 10 insertions, 1 deletions
diff --git a/apps/files_sharing/lib/external/manager.php b/apps/files_sharing/lib/external/manager.php
index 4441a72fb16..e4e4d60029d 100644
--- a/apps/files_sharing/lib/external/manager.php
+++ b/apps/files_sharing/lib/external/manager.php
@@ -108,7 +108,9 @@ class Manager {
* @return Mount
*/
protected function mountShare($data) {
+ $data['manager'] = $this;
$mountPoint = '/' . $this->userSession->getUser()->getUID() . '/files' . $data['mountpoint'];
+ $data['mountpoint'] = $mountPoint;
$mount = new Mount(self::STORAGE, $mountPoint, $data, $this, $this->storageLoader);
$this->mountManager->addMount($mount);
return $mount;
diff --git a/apps/files_sharing/lib/external/storage.php b/apps/files_sharing/lib/external/storage.php
index be3f367c383..cbde21d14fb 100644
--- a/apps/files_sharing/lib/external/storage.php
+++ b/apps/files_sharing/lib/external/storage.php
@@ -39,7 +39,13 @@ class Storage extends DAV implements ISharedStorage {
private $updateChecked = false;
+ /**
+ * @var \OCA\Files_Sharing\External\Manager
+ */
+ private $manager;
+
public function __construct($options) {
+ $this->manager = $options['manager'];
$this->remote = $options['remote'];
$this->remoteUser = $options['owner'];
list($protocol, $remote) = explode('://', $this->remote);
@@ -134,7 +140,8 @@ class Storage extends DAV implements ISharedStorage {
if ($this->testRemote()) {
// valid ownCloud instance means that the public share no longer exists
// since this is permanent (re-sharing the file will create a new token)
- // we mark the storage as invalid
+ // we remove the invalid storage
+ $this->manager->removeShare($this->mountPoint);
throw new StorageInvalidException();
} else {
// ownCloud instance is gone, likely to be a temporary server configuration error