mirror of
https://github.com/nextcloud/server.git
synced 2026-05-28 04:32:30 -04:00
parent
f23d641b82
commit
84f3dd15a6
2 changed files with 15 additions and 0 deletions
|
|
@ -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 a new issue