[Pkg-owncloud-commits] [owncloud] 114/131: Double slash for SMB storage id for compatibility

David Prévot taffit at moszumanska.debian.org
Tue Aug 11 15:58:43 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to annotated tag v8.1.1
in repository owncloud.

commit dcd5666601186657086577f42ad2c7f0ad22b0ca
Author: Vincent Petry <pvince81 at owncloud.com>
Date:   Tue Jul 28 11:18:03 2015 +0200

    Double slash for SMB storage id for compatibility
---
 apps/files_external/lib/smb.php            |  5 ++++-
 apps/files_external/tests/backends/smb.php | 12 ++++++++++++
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/apps/files_external/lib/smb.php b/apps/files_external/lib/smb.php
index 4a2eebf..f58cd98 100644
--- a/apps/files_external/lib/smb.php
+++ b/apps/files_external/lib/smb.php
@@ -78,7 +78,10 @@ class SMB extends Common {
 	 * @return string
 	 */
 	public function getId() {
-		return 'smb::' . $this->server->getUser() . '@' . $this->server->getHost() . '/' . $this->share->getName() . '/' . $this->root;
+		// FIXME: double slash to keep compatible with the old storage ids,
+		// failure to do so will lead to creation of a new storage id and
+		// loss of shares from the storage
+		return 'smb::' . $this->server->getUser() . '@' . $this->server->getHost() . '//' . $this->share->getName() . '/' . $this->root;
 	}
 
 	/**
diff --git a/apps/files_external/tests/backends/smb.php b/apps/files_external/tests/backends/smb.php
index 9e60a9e..0da86cb 100644
--- a/apps/files_external/tests/backends/smb.php
+++ b/apps/files_external/tests/backends/smb.php
@@ -61,4 +61,16 @@ class SMB extends Storage {
 		$this->assertTrue($result);
 		$this->assertTrue($this->instance->is_dir('foo bar'));
 	}
+
+	public function testStorageId() {
+		$this->instance = new \OC\Files\Storage\SMB([
+			'host' => 'testhost',
+			'user' => 'testuser',
+			'password' => 'somepass',
+			'share' => 'someshare',
+			'root' => 'someroot',
+		]);
+		$this->assertEquals('smb::testuser at testhost//someshare//someroot/', $this->instance->getId());
+		$this->instance = null;
+	}
 }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list