Code Duplication    Length = 11-11 lines in 2 locations

code/Controller/AssetAdmin.php 2 locations

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