- return ['image_extension', 'mimes:jpeg,png,gif,webp', 'max:' . (config('app.upload_limit') * 1000)];
+ return ['image_extension', 'mimes:jpeg,png,gif,webp,avif', 'max:' . (config('app.upload_limit') * 1000)];
+ }
+
+ /**
+ * Redirect to the URL provided in the request as a '_return' parameter.
+ * Will check that the parameter leads to a URL under the root path of the system.
+ */
+ protected function redirectToRequest(Request $request): RedirectResponse
+ {
+ $basePath = url('/');
+ $returnUrl = $request->input('_return') ?? $basePath;
+
+ if (!str_starts_with($returnUrl, $basePath)) {
+ return redirect($basePath);
+ }
+
+ return redirect($returnUrl);