Code Duplication    Length = 7-9 lines in 2 locations

lib/Controller/WopiController.php 2 locations

@@ 410-418 (lines=9) @@
407
				$suggested = $this->request->getHeader('X-WOPI-SuggestedTarget');
408
				$suggested = iconv('utf-7', 'utf-8', $suggested);
409
410
				if ($suggested[0] === '.') {
411
					$path = dirname($file->getPath()) . '/New File' . $suggested;
412
				}
413
				else if ($suggested[0] !== '/') {
414
					$path = dirname($file->getPath()) . '/' . $suggested;
415
				}
416
				else {
417
					$path = $userFolder->getPath() . $suggested;
418
				}
419
420
				if ($path === '') {
421
					return new JSONResponse([
@@ 565-571 (lines=7) @@
562
				$suggested = $this->request->getHeader('X-WOPI-SuggestedTarget');
563
				$suggested = iconv('utf-7', 'utf-8', $suggested);
564
565
				if ($suggested[0] === '.') {
566
					$path = dirname($file->getPath()) . '/New File' . $suggested;
567
				} else if ($suggested[0] !== '/') {
568
					$path = dirname($file->getPath()) . '/' . $suggested;
569
				} else {
570
					$path = $userFolder->getPath() . $suggested;
571
				}
572
573
				if ($path === '') {
574
					return new JSONResponse([