Merge pull request #17922 from owncloud/smb-storageiddoubleslash

Double slash for SMB storage id for compatibility
This commit is contained in:
Robin McCorkell 2015-07-28 19:54:11 +01:00
commit 6f72c37464
2 changed files with 16 additions and 1 deletions

View File

@ -78,7 +78,10 @@ class SMB extends Common {
* @return string * @return string
*/ */
public function getId() { 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;
} }
/** /**

View File

@ -61,4 +61,16 @@ class SMB extends Storage {
$this->assertTrue($result); $this->assertTrue($result);
$this->assertTrue($this->instance->is_dir('foo bar')); $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@testhost//someshare//someroot/', $this->instance->getId());
$this->instance = null;
}
} }