Code Duplication    Length = 7-9 lines in 2 locations

lib/Controller/WopiController.php 2 locations

@@ 394-402 (lines=9) @@
391
				$suggested = $this->request->getHeader('X-WOPI-SuggestedTarget');
392
				$suggested = iconv('utf-7', 'utf-8', $suggested);
393
394
				if ($suggested[0] === '.') {
395
					$path = dirname($file->getPath()) . '/New File' . $suggested;
396
				}
397
				else if ($suggested[0] !== '/') {
398
					$path = dirname($file->getPath()) . '/' . $suggested;
399
				}
400
				else {
401
					$path = $userFolder->getPath() . $suggested;
402
				}
403
404
				if ($path === '') {
405
					return new JSONResponse([
@@ 542-548 (lines=7) @@
539
				$suggested = $this->request->getHeader('X-WOPI-SuggestedTarget');
540
				$suggested = iconv('utf-7', 'utf-8', $suggested);
541
542
				if ($suggested[0] === '.') {
543
					$path = dirname($file->getPath()) . '/New File' . $suggested;
544
				} else if ($suggested[0] !== '/') {
545
					$path = dirname($file->getPath()) . '/' . $suggested;
546
				} else {
547
					$path = $userFolder->getPath() . $suggested;
548
				}
549
550
				if ($path === '') {
551
					return new JSONResponse([