Code Duplication    Length = 3-3 lines in 3 locations

apps/files_sharing/lib/External/Storage.php 1 location

@@ 101-103 (lines=3) @@
98
		);
99
100
		$this->root = \rtrim($this->root, '/') . $discoveryManager->getWebDavEndpoint($this->remote);
101
		if (!$this->root || $this->root[0] !== '/') {
102
			$this->root = '/' . $this->root;
103
		}
104
		if (\substr($this->root, -1, 1) !== '/') {
105
			$this->root .= '/';
106
		}

apps/files_external/lib/Lib/Storage/SMB.php 1 location

@@ 97-99 (lines=3) @@
94
			$this->log("using $shareClass for the connection");
95
96
			$this->root = isset($params['root']) ? $params['root'] : '/';
97
			if (!$this->root || $this->root[0] != '/') {
98
				$this->root = '/' . $this->root;
99
			}
100
			if (\substr($this->root, -1, 1) != '/') {
101
				$this->root .= '/';
102
			}

lib/private/Files/Storage/DAV.php 1 location

@@ 122-124 (lines=3) @@
119
				$this->secure = false;
120
			}
121
			$this->root = isset($params['root']) ? $params['root'] : '/';
122
			if (!$this->root || $this->root[0] != '/') {
123
				$this->root = '/' . $this->root;
124
			}
125
			if (\substr($this->root, -1, 1) != '/') {
126
				$this->root .= '/';
127
			}