diff --git a/src/Http/Controllers/VoyagerMediaController.php b/src/Http/Controllers/VoyagerMediaController.php index 435f6281de..fe721a7218 100644 --- a/src/Http/Controllers/VoyagerMediaController.php +++ b/src/Http/Controllers/VoyagerMediaController.php @@ -240,8 +240,10 @@ public function upload(Request $request) } if (!$request->has('filename') || $request->get('filename') == 'null') { - while (Storage::disk($this->filesystem)->exists(Str::finish($request->upload_path, '/').$name.'.'.$extension, $this->filesystem)) { - $name = get_file_name($name); + if (!$details->preserveFileUploadName) { + while (Storage::disk($this->filesystem)->exists(Str::finish($request->upload_path, '/').$name.'.'.$extension, $this->filesystem)) { + $name = get_file_name($name); + } } } else { $name = str_replace('{uid}', Auth::user()->getKey(), $request->get('filename'));