Code Duplication    Length = 7-9 lines in 2 locations

lib/Controller/WopiController.php 2 locations

@@ 406-414 (lines=9) @@
403
				$suggested = $this->request->getHeader('X-WOPI-SuggestedTarget');
404
				$suggested = iconv('utf-7', 'utf-8', $suggested);
405
406
				if ($suggested[0] === '.') {
407
					$path = dirname($file->getPath()) . '/New File' . $suggested;
408
				}
409
				else if ($suggested[0] !== '/') {
410
					$path = dirname($file->getPath()) . '/' . $suggested;
411
				}
412
				else {
413
					$path = $userFolder->getPath() . $suggested;
414
				}
415
416
				if ($path === '') {
417
					return new JSONResponse([
@@ 561-567 (lines=7) @@
558
				$suggested = $this->request->getHeader('X-WOPI-SuggestedTarget');
559
				$suggested = iconv('utf-7', 'utf-8', $suggested);
560
561
				if ($suggested[0] === '.') {
562
					$path = dirname($file->getPath()) . '/New File' . $suggested;
563
				} else if ($suggested[0] !== '/') {
564
					$path = dirname($file->getPath()) . '/' . $suggested;
565
				} else {
566
					$path = $userFolder->getPath() . $suggested;
567
				}
568
569
				if ($path === '') {
570
					return new JSONResponse([