Code Duplication    Length = 11-11 lines in 2 locations

code/Controller/AssetAdmin.php 2 locations

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