Code Duplication    Length = 11-11 lines in 2 locations

code/Controller/AssetAdmin.php 2 locations

@@ 376-386 (lines=11) @@
373
        $file = Injector::inst()->create($fileClass);
374
375
        // check canCreate permissions
376
        if (!$file->canCreate(null, $data)) {
377
            $result = ['message' => [
378
                'type' => 'error',
379
                'value' => _t(
380
                    'SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.CreatePermissionDenied',
381
                    'You do not have permission to add files'
382
                )
383
            ]];
384
            return (new HTTPResponse(json_encode($result), 403))
385
                ->addHeader('Content-Type', 'application/json');
386
        }
387
388
        $uploadResult = $upload->loadIntoFile($tmpFile, $file, $parentRecord ? $parentRecord->getFilename() : '/');
389
        if(!$uploadResult) {
@@ 389-399 (lines=11) @@
386
        }
387
388
        $uploadResult = $upload->loadIntoFile($tmpFile, $file, $parentRecord ? $parentRecord->getFilename() : '/');
389
        if(!$uploadResult) {
390
            $result = ['message' => [
391
                'type' => 'error',
392
                'value' => _t(
393
                    'SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.LoadIntoFileFailed',
394
                    'Failed to load file'
395
                )
396
            ]];
397
            return (new HTTPResponse(json_encode($result), 400))
398
                ->addHeader('Content-Type', 'application/json');
399
        }
400
401
        $file->ParentID = $parentRecord ? $parentRecord->ID : 0;
402
        $file->write();