mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-25 05:34:06 -08:00
Correctly call the validator in the response if it fails
Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
parent
ae90f9defa
commit
57372fc82a
|
@ -26,7 +26,7 @@ use Response;
|
|||
use App\Http\Requests\SlackSettingsRequest;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use Validator;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
|
||||
/**
|
||||
* This controller handles all actions related to Settings for
|
||||
|
@ -1248,13 +1248,11 @@ class SettingsController extends Controller
|
|||
if (!$request->hasFile('file')) {
|
||||
return redirect()->route('settings.backups.index')->with('error', 'No file uploaded');
|
||||
} else {
|
||||
|
||||
$max_file_size = Helper::file_upload_max_size();
|
||||
|
||||
$rules = [
|
||||
$validator = Validator::make($request->all(), [
|
||||
'file' => 'required|mimes:zip|max:'.$max_file_size,
|
||||
];
|
||||
|
||||
$validator = \Validator::make($request->all(), $rules);
|
||||
]);
|
||||
|
||||
if ($validator->passes()) {
|
||||
|
||||
|
@ -1265,7 +1263,7 @@ class SettingsController extends Controller
|
|||
return redirect()->route('settings.backups.index')->with('success', 'File uploaded');
|
||||
}
|
||||
|
||||
return redirect()->route('settings.backups.index')->withErrors($request->getErrors());
|
||||
return redirect()->route('settings.backups.index')->withErrors($validator);
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue