Code Duplication    Length = 11-11 lines in 2 locations

code/Controller/AssetAdmin.php 2 locations

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