Merge pull request #11147 from inietov/fixes/argument_passed_to_ItemImportRequest_is_null

FixesArgument 1 passed to App\Http\Requests\ItemImportRequest::import() must be an instance of App\Models\Import, null given
This commit is contained in:
snipe 2022-05-18 04:24:46 -07:00 committed by GitHub
commit b426fa352e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -134,7 +134,14 @@ class ImportController extends Controller
\Log::debug('NO BACKUP requested via importer');
}
$errors = $request->import(Import::find($import_id));
$import = Import::find($import_id);
if(is_null($import)){
$error[0][0] = trans("validation.exists", ["attribute" => "file"]);
return response()->json(Helper::formatStandardApiResponse('import-errors', null, $error), 500);
}
$errors = $request->import($import);
$redirectTo = 'hardware.index';
switch ($request->get('import-type')) {
case 'asset':