Code Duplication    Length = 11-12 lines in 2 locations

lib/private/Files/ObjectStore/ObjectStoreStorage.php 1 location

@@ 120-131 (lines=12) @@
117
	 * @param string $path
118
	 * @return string
119
	 */
120
	private function normalizePath($path) {
121
		$path = trim($path, '/');
122
		//FIXME why do we sometimes get a path like 'files//username'?
123
		$path = str_replace('//', '/', $path);
124
125
		// dirname('/folder') returns '.' but internally (in the cache) we store the root as ''
126
		if (!$path || $path === '.') {
127
			$path = '';
128
		}
129
130
		return $path;
131
	}
132
133
	/**
134
	 * Object Stores use a NoopScanner because metadata is directly stored in

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

@@ 88-98 (lines=11) @@
85
	 * @param string $path
86
	 * @return mixed|string
87
	 */
88
	private function normalizePath(string $path) {
89
		$path = trim($path, '/');
90
91
		if (!$path) {
92
			$path = '.';
93
		}
94
95
		$path = str_replace('#', '%23', $path);
96
97
		return $path;
98
	}
99
100
	const SUBCONTAINER_FILE = '.subcontainers';
101