Code Duplication    Length = 7-9 lines in 2 locations

lib/Controller/WopiController.php 2 locations

@@ 422-430 (lines=9) @@
419
				$suggested = $this->request->getHeader('X-WOPI-SuggestedTarget');
420
				$suggested = iconv('utf-7', 'utf-8', $suggested);
421
422
				if ($suggested[0] === '.') {
423
					$path = dirname($file->getPath()) . '/New File' . $suggested;
424
				}
425
				else if ($suggested[0] !== '/') {
426
					$path = dirname($file->getPath()) . '/' . $suggested;
427
				}
428
				else {
429
					$path = $userFolder->getPath() . $suggested;
430
				}
431
432
				if ($path === '') {
433
					return new JSONResponse([
@@ 577-583 (lines=7) @@
574
				$suggested = $this->request->getHeader('X-WOPI-SuggestedTarget');
575
				$suggested = iconv('utf-7', 'utf-8', $suggested);
576
577
				if ($suggested[0] === '.') {
578
					$path = dirname($file->getPath()) . '/New File' . $suggested;
579
				} else if ($suggested[0] !== '/') {
580
					$path = dirname($file->getPath()) . '/' . $suggested;
581
				} else {
582
					$path = $userFolder->getPath() . $suggested;
583
				}
584
585
				if ($path === '') {
586
					return new JSONResponse([