Code Duplication    Length = 6-6 lines in 2 locations

lib/Controller/DocumentController.php 2 locations

@@ 516-521 (lines=6) @@
513
			], Http::STATUS_BAD_REQUEST);
514
		}
515
516
		if (!($folder instanceof Folder)) {
517
			return new JSONResponse([
518
				'status' => 'error',
519
				'message' => $this->l10n->t('Can\'t create document')
520
			], Http::STATUS_BAD_REQUEST);
521
		}
522
523
		$basename = $this->l10n->t('New Document.odt');
524
		switch ($mimetype) {
@@ 550-555 (lines=6) @@
547
			$filename = Helper::getNewFileName($folder, $basename);
548
		}
549
550
		if ($folder->nodeExists($filename)) {
551
			return new JSONResponse([
552
				'status' => 'error',
553
				'message' => $this->l10n->t('Document already exists')
554
			], Http::STATUS_BAD_REQUEST);
555
		}
556
557
		try {
558
			$file = $folder->newFile($filename);