Code Duplication    Length = 6-6 lines in 2 locations

lib/Controller/DocumentController.php 2 locations

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