Code Duplication    Length = 6-6 lines in 2 locations

lib/Controller/DocumentController.php 2 locations

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