From 9ff51aafc518460e6c45996f09e9fe74e5f8d2e8 Mon Sep 17 00:00:00 2001 From: Morris Jobke Date: Thu, 25 Jan 2018 22:26:47 +0100 Subject: Use index based string access for substr with length of 1 Signed-off-by: Morris Jobke --- apps/files_external/lib/Lib/Storage/SFTP.php | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'apps/files_external/lib/Lib/Storage/SFTP.php') 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, '/') . '/'; } /** -- cgit v1.2.3