Code Duplication    Length = 6-6 lines in 2 locations

lib/Controller/DocumentController.php 2 locations

@@ 315-320 (lines=6) @@
312
			], Http::STATUS_BAD_REQUEST);
313
		}
314
315
		if (!($folder instanceof Folder)) {
316
			return new JSONResponse([
317
				'status' => 'error',
318
				'message' => $this->l10n->t('Can\'t create document')
319
			], Http::STATUS_BAD_REQUEST);
320
		}
321
322
		$basename = $this->l10n->t('New Document.odt');
323
		switch ($mimetype) {
@@ 349-354 (lines=6) @@
346
			$filename = Helper::getNewFileName($folder, $basename);
347
		}
348
349
		if ($folder->nodeExists($filename)) {
350
			return new JSONResponse([
351
				'status' => 'error',
352
				'message' => $this->l10n->t('Document already exists')
353
			], Http::STATUS_BAD_REQUEST);
354
		}
355
356
		try {
357
			$file = $folder->newFile($filename);