From d4c1e145fa9e28eae216da4bc360b84fa0783adc Mon Sep 17 00:00:00 2001 From: Anthony Bocci Date: Sat, 24 Mar 2018 00:05:20 +0100 Subject: [PATCH] Redirect to setting page on image uploading error In the settings we can upload an image as banner. There are some verifications that are done on the file to check that it's a valid image. If the file is not valid, a redirection is done to the theme page with an error message. When redirecting to the theme page because of an error on the file, the controller redirects to an URL set in a variable. The problem was this variable '$redirectUrl' was undefined, so the controller thrown an error. The problem occured only if there was an error on the file, but it worked well if the file was a valid image. In the controller's constructor a 'submenu' field is set with panel items and url, so the variable '$redirectUrl' is set to the theme page URL. Now if there is an error with the file, the user is well redirected and the error is displayed. See: CachetHQ/Cachet#2956 --- app/Http/Controllers/Dashboard/SettingsController.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/Http/Controllers/Dashboard/SettingsController.php b/app/Http/Controllers/Dashboard/SettingsController.php index 44201e57..5417f59d 100644 --- a/app/Http/Controllers/Dashboard/SettingsController.php +++ b/app/Http/Controllers/Dashboard/SettingsController.php @@ -397,6 +397,7 @@ class SettingsController extends Controller protected function handleUpdateBanner(Repository $setting) { $file = Binput::file('app_banner'); + $redirectUrl = $this->subMenu['theme']['url']; // Image Validation. // Image size in bytes.