Code Duplication    Length = 6-6 lines in 2 locations

lib/Controller/DocumentController.php 2 locations

@@ 495-500 (lines=6) @@
492
			], Http::STATUS_BAD_REQUEST);
493
		}
494
495
		if (!($folder instanceof Folder)) {
496
			return new JSONResponse([
497
				'status' => 'error',
498
				'message' => $this->l10n->t('Can\'t create document')
499
			], Http::STATUS_BAD_REQUEST);
500
		}
501
502
		$basename = $this->l10n->t('New Document.odt');
503
		switch ($mimetype) {
@@ 529-534 (lines=6) @@
526
			$filename = Helper::getNewFileName($folder, $basename);
527
		}
528
529
		if ($folder->nodeExists($filename)) {
530
			return new JSONResponse([
531
				'status' => 'error',
532
				'message' => $this->l10n->t('Document already exists')
533
			], Http::STATUS_BAD_REQUEST);
534
		}
535
536
		try {
537
			$file = $folder->newFile($filename);