diff --git a/apps/files_external/3rdparty/smb4php/smb.php b/apps/files_external/3rdparty/smb4php/smb.php index aec181a350..e91b0a5958 100644 --- a/apps/files_external/3rdparty/smb4php/smb.php +++ b/apps/files_external/3rdparty/smb4php/smb.php @@ -307,7 +307,8 @@ class smb { trigger_error('rename(): error in URL', E_USER_ERROR); } smb::clearstatcache ($url_from); - return smb::execute ('rename "'.$from['path'].'" "'.$to['path'].'"', $to); + $result = smb::execute ('rename "'.$from['path'].'" "'.$to['path'].'"', $to); + return $result !== false; } function mkdir ($url, $mode, $options) { diff --git a/apps/files_external/tests/smb.php b/apps/files_external/tests/smb.php index ca2a93c894..86dbd3ab88 100644 --- a/apps/files_external/tests/smb.php +++ b/apps/files_external/tests/smb.php @@ -15,7 +15,7 @@ class SMB extends Storage { public function setUp() { $id = uniqid(); $this->config = include('files_external/tests/config.php'); - if ( ! is_array($this->config) or ! isset($this->config['smb']) or ! $this->config['smb']['run']) { + if (!is_array($this->config) or !isset($this->config['smb']) or !$this->config['smb']['run']) { $this->markTestSkipped('Samba backend not configured'); } $this->config['smb']['root'] .= $id; //make sure we have an new empty folder to work in @@ -28,4 +28,10 @@ class SMB extends Storage { \OCP\Files::rmdirr($this->instance->constructUrl('')); } } + + public function testRenameWithSpaces() { + $this->instance->mkdir('with spaces'); + $result = $this->instance->rename('with spaces', 'foo bar'); + $this->assertTrue($result); + } }