Code Duplication    Length = 11-11 lines in 2 locations

code/Controller/AssetAdmin.php 2 locations

@@ 257-267 (lines=11) @@
254
        $file = Injector::inst()->create($fileClass);
255
256
        // check canCreate permissions
257
        if (!$file->canCreate(null, $data)) {
258
            $result = ['message' => [
259
                'type' => 'error',
260
                'value' => _t(
261
                    'SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.CreatePermissionDenied',
262
                    'You do not have permission to add files'
263
                )
264
            ]];
265
            return (new HTTPResponse(json_encode($result), 403))
266
                ->addHeader('Content-Type', 'application/json');
267
        }
268
269
        $uploadResult = $upload->loadIntoFile($tmpFile, $file, $parentRecord ? $parentRecord->getFilename() : '/');
270
        if (!$uploadResult) {
@@ 270-280 (lines=11) @@
267
        }
268
269
        $uploadResult = $upload->loadIntoFile($tmpFile, $file, $parentRecord ? $parentRecord->getFilename() : '/');
270
        if (!$uploadResult) {
271
            $result = ['message' => [
272
                'type' => 'error',
273
                'value' => _t(
274
                    'SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.LoadIntoFileFailed',
275
                    'Failed to load file'
276
                )
277
            ]];
278
            return (new HTTPResponse(json_encode($result), 400))
279
                ->addHeader('Content-Type', 'application/json');
280
        }
281
282
        $file->ParentID = $parentRecord ? $parentRecord->ID : 0;
283
        $file->write();