Return a file not found error if it doesn’t appear on disk

Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
snipe 2023-03-06 15:09:37 -08:00
parent 8b6e8898c1
commit e1069ac234

View file

@ -128,10 +128,12 @@ class ImportController extends Controller
$import->file_path = $file_name;
$import->filesize = null;
if (file_exists($path.'/'.$file_name)) {
$import->filesize = filesize($path.'/'.$file_name);
if (!file_exists($path.'/'.$file_name)) {
return response()->json(Helper::formatStandardApiResponse('error', null, trans('general.file_not_found')), 500);
}
$import->filesize = filesize($path.'/'.$file_name);
$import->save();
$results[] = $import;
}