Code Duplication    Length = 6-6 lines in 2 locations

lib/Controller/DocumentController.php 2 locations

@@ 483-488 (lines=6) @@
480
			], Http::STATUS_BAD_REQUEST);
481
		}
482
483
		if (!($folder instanceof Folder)) {
484
			return new JSONResponse([
485
				'status' => 'error',
486
				'message' => $this->l10n->t('Can\'t create document')
487
			], Http::STATUS_BAD_REQUEST);
488
		}
489
490
		$basename = $this->l10n->t('New Document.odt');
491
		switch ($mimetype) {
@@ 517-522 (lines=6) @@
514
			$filename = Helper::getNewFileName($folder, $basename);
515
		}
516
517
		if ($folder->nodeExists($filename)) {
518
			return new JSONResponse([
519
				'status' => 'error',
520
				'message' => $this->l10n->t('Document already exists')
521
			], Http::STATUS_BAD_REQUEST);
522
		}
523
524
		try {
525
			$file = $folder->newFile($filename);