Code Duplication    Length = 11-11 lines in 2 locations

code/Controller/AssetAdmin.php 2 locations

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