Code Duplication    Length = 11-11 lines in 2 locations

code/Controller/AssetAdmin.php 2 locations

@@ 415-425 (lines=11) @@
412
        $file = Injector::inst()->create($fileClass);
413
414
        // check canCreate permissions
415
        if (!$file->canCreate(null, $data)) {
416
            $result = ['message' => [
417
                'type' => 'error',
418
                'value' => _t(
419
                    'SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.CreatePermissionDenied',
420
                    'You do not have permission to add files'
421
                )
422
            ]];
423
            return (new HTTPResponse(json_encode($result), 403))
424
                ->addHeader('Content-Type', 'application/json');
425
        }
426
427
        $uploadResult = $upload->loadIntoFile($tmpFile, $file, $parentRecord ? $parentRecord->getFilename() : '/');
428
        if(!$uploadResult) {
@@ 428-438 (lines=11) @@
425
        }
426
427
        $uploadResult = $upload->loadIntoFile($tmpFile, $file, $parentRecord ? $parentRecord->getFilename() : '/');
428
        if(!$uploadResult) {
429
            $result = ['message' => [
430
                'type' => 'error',
431
                'value' => _t(
432
                    'SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.LoadIntoFileFailed',
433
                    'Failed to load file'
434
                )
435
            ]];
436
            return (new HTTPResponse(json_encode($result), 400))
437
                ->addHeader('Content-Type', 'application/json');
438
        }
439
440
        $file->ParentID = $parentRecord ? $parentRecord->ID : 0;
441
        $file->write();