Code Duplication    Length = 4-5 lines in 2 locations

code/Controller/AssetAdmin.php 2 locations

@@ 332-336 (lines=5) @@
329
        $data['Parent'] = $parentRecord;
330
331
        $tmpFile = $request->postVar('Upload');
332
        if(!$upload->validate($tmpFile)) {
333
            $result = ['error' => $upload->getErrors()];
334
            return (new HTTPResponse(json_encode($result), 400))
335
                ->addHeader('Content-Type', 'application/json');
336
        }
337
338
        // TODO Allow batch uploads
339
        $fileClass = File::get_class_for_file_extension(File::get_file_extension($tmpFile['name']));
@@ 672-675 (lines=4) @@
669
                ->addHeader('Content-Type', 'application/json');
670
        }
671
672
        if (!$record->canEdit() || ($doPublish && !$record->canPublish())) {
673
            return (new HTTPResponse(json_encode(['status' => 'error']), 401))
674
                ->addHeader('Content-Type', 'application/json');
675
        }
676
677
        $form->saveInto($record);
678
        $record->write();