parent
f23d641b82
commit
84f3dd15a6
|
@ -35,6 +35,9 @@ class FTP extends \OC\Files\Storage\StreamWrapper{
|
|||
if ( ! $this->root || $this->root[0]!='/') {
|
||||
$this->root='/'.$this->root;
|
||||
}
|
||||
if (substr($this->root, -1) !== '/') {
|
||||
$this->root .= '/';
|
||||
}
|
||||
} else {
|
||||
throw new \Exception();
|
||||
}
|
||||
|
|
|
@ -48,5 +48,17 @@ class FTP extends Storage {
|
|||
$config['secure'] = 'true';
|
||||
$instance = new \OC\Files\Storage\FTP($config);
|
||||
$this->assertEquals('ftps://ftp:ftp@localhost/', $instance->constructUrl(''));
|
||||
|
||||
$config['root'] = '';
|
||||
$instance = new \OC\Files\Storage\FTP($config);
|
||||
$this->assertEquals('ftps://ftp:ftp@localhost/somefile.txt', $instance->constructUrl('somefile.txt'));
|
||||
|
||||
$config['root'] = '/abc';
|
||||
$instance = new \OC\Files\Storage\FTP($config);
|
||||
$this->assertEquals('ftps://ftp:ftp@localhost/abc/somefile.txt', $instance->constructUrl('somefile.txt'));
|
||||
|
||||
$config['root'] = '/abc/';
|
||||
$instance = new \OC\Files\Storage\FTP($config);
|
||||
$this->assertEquals('ftps://ftp:ftp@localhost/abc/somefile.txt', $instance->constructUrl('somefile.txt'));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue