Code Duplication    Length = 7-9 lines in 2 locations

lib/Controller/WopiController.php 2 locations

@@ 273-281 (lines=9) @@
270
				$suggested = $this->request->getHeader('X-WOPI-SuggestedTarget');
271
				$suggested = iconv('utf-7', 'utf-8', $suggested);
272
273
				if ($suggested[0] === '.') {
274
					$path = dirname($file->getPath()) . '/New File' . $suggested;
275
				}
276
				else if ($suggested[0] !== '/') {
277
					$path = dirname($file->getPath()) . '/' . $suggested;
278
				}
279
				else {
280
					$path = $userFolder->getPath() . $suggested;
281
				}
282
283
				if ($path === '') {
284
					return new JSONResponse([
@@ 382-388 (lines=7) @@
379
				$suggested = $this->request->getHeader('X-WOPI-SuggestedTarget');
380
				$suggested = iconv('utf-7', 'utf-8', $suggested);
381
382
				if ($suggested[0] === '.') {
383
					$path = dirname($file->getPath()) . '/New File' . $suggested;
384
				} else if ($suggested[0] !== '/') {
385
					$path = dirname($file->getPath()) . '/' . $suggested;
386
				} else {
387
					$path = $userFolder->getPath() . $suggested;
388
				}
389
390
				if ($path === '') {
391
					return new JSONResponse([