mirror of
https://github.com/snipe/snipe-it.git
synced 2025-03-05 20:52:15 -08:00
Merge pull request #12623 from snipe/bug/sc-20254/errorexception-filesize-stat-failed-for-snipe
Check that the file exists before trying to stat it for filesize
This commit is contained in:
commit
0d3388b3ae
|
@ -126,7 +126,14 @@ class ImportController extends Controller
|
|||
}
|
||||
$file_name = date('Y-m-d-his').'-'.$fixed_filename;
|
||||
$import->file_path = $file_name;
|
||||
$import->filesize = null;
|
||||
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -271,7 +271,7 @@ class SettingsController extends Controller
|
|||
$headers = ['ContentType' => 'application/zip'];
|
||||
return Storage::download($path.'/'.$file, $file, $headers);
|
||||
} else {
|
||||
return response()->json(Helper::formatStandardApiResponse('error', null, 'File not found'));
|
||||
return response()->json(Helper::formatStandardApiResponse('error', null, trans('general.file_not_found')));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -395,7 +395,7 @@ return [
|
|||
'end_date' => 'Enddatum',
|
||||
'alt_uploaded_image_thumbnail' => 'Hochgeladene Miniaturansicht',
|
||||
'placeholder_kit' => 'Kit auswählen',
|
||||
'file_not_found' => 'File not found',
|
||||
'file_not_found' => 'File not found on server',
|
||||
'preview_not_available' => '(no preview)',
|
||||
'setup' => 'Setup',
|
||||
'pre_flight' => 'Pre-Flight',
|
||||
|
|
Loading…
Reference in a new issue