diff options
author | Morris Jobke <hey@morrisjobke.de> | 2018-01-25 22:26:47 +0100 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2018-01-26 13:38:34 +0100 |
commit | 9ff51aafc518460e6c45996f09e9fe74e5f8d2e8 (patch) | |
tree | 7aa302bf04530f0add196f6bcd6e8636333e6be0 /apps/files_external/lib/Lib/Storage/SFTP.php | |
parent | b9bbb894f8b01e000bb5e3a8a82db7bebad3ea00 (diff) | |
download | nextcloud-server-9ff51aafc518460e6c45996f09e9fe74e5f8d2e8.tar.gz nextcloud-server-9ff51aafc518460e6c45996f09e9fe74e5f8d2e8.zip |
Use index based string access for substr with length of 1
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Diffstat (limited to 'apps/files_external/lib/Lib/Storage/SFTP.php')
-rw-r--r-- | apps/files_external/lib/Lib/Storage/SFTP.php | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/apps/files_external/lib/Lib/Storage/SFTP.php b/apps/files_external/lib/Lib/Storage/SFTP.php index 22162fa61cf..6bd77dd2496 100644 --- a/apps/files_external/lib/Lib/Storage/SFTP.php +++ b/apps/files_external/lib/Lib/Storage/SFTP.php @@ -103,13 +103,8 @@ class SFTP extends \OC\Files\Storage\Common { $this->root = isset($params['root']) ? $this->cleanPath($params['root']) : '/'; - if ($this->root[0] !== '/') { - $this->root = '/' . $this->root; - } - - if (substr($this->root, -1, 1) !== '/') { - $this->root .= '/'; - } + $this->root = '/' . ltrim($this->root, '/'); + $this->root = rtrim($this->root, '/') . '/'; } /** |