summaryrefslogtreecommitdiffstats
path: root/lib/private/Files/Storage/DAV.php
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2018-01-25 22:26:47 +0100
committerMorris Jobke <hey@morrisjobke.de>2018-01-26 13:38:34 +0100
commit9ff51aafc518460e6c45996f09e9fe74e5f8d2e8 (patch)
tree7aa302bf04530f0add196f6bcd6e8636333e6be0 /lib/private/Files/Storage/DAV.php
parentb9bbb894f8b01e000bb5e3a8a82db7bebad3ea00 (diff)
downloadnextcloud-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 'lib/private/Files/Storage/DAV.php')
-rw-r--r--lib/private/Files/Storage/DAV.php10
1 files changed, 3 insertions, 7 deletions
diff --git a/lib/private/Files/Storage/DAV.php b/lib/private/Files/Storage/DAV.php
index 43347aa0b8f..f9c6175308c 100644
--- a/lib/private/Files/Storage/DAV.php
+++ b/lib/private/Files/Storage/DAV.php
@@ -118,13 +118,9 @@ class DAV extends Common {
$this->certPath = $certPath;
}
}
- $this->root = isset($params['root']) ? $params['root'] : '/';
- if (!$this->root || $this->root[0] != '/') {
- $this->root = '/' . $this->root;
- }
- if (substr($this->root, -1, 1) != '/') {
- $this->root .= '/';
- }
+ $this->root = $params['root'] ?? '/';
+ $this->root = '/' . ltrim($this->root, '/');
+ $this->root = rtrim($this->root, '/') . '/';
} else {
throw new \Exception('Invalid webdav storage configuration');
}