Code Duplication    Length = 6-6 lines in 2 locations

lib/Controller/DocumentController.php 2 locations

@@ 368-373 (lines=6) @@
365
			], Http::STATUS_BAD_REQUEST);
366
		}
367
368
		if (!($folder instanceof Folder)) {
369
			return new JSONResponse([
370
				'status' => 'error',
371
				'message' => $this->l10n->t('Can\'t create document')
372
			], Http::STATUS_BAD_REQUEST);
373
		}
374
375
		$basename = $this->l10n->t('New Document.odt');
376
		switch ($mimetype) {
@@ 402-407 (lines=6) @@
399
			$filename = Helper::getNewFileName($folder, $basename);
400
		}
401
402
		if ($folder->nodeExists($filename)) {
403
			return new JSONResponse([
404
				'status' => 'error',
405
				'message' => $this->l10n->t('Document already exists')
406
			], Http::STATUS_BAD_REQUEST);
407
		}
408
409
		try {
410
			$file = $folder->newFile($filename);