From 4a9706552e8013efd6f11f593af6c78208d42876 Mon Sep 17 00:00:00 2001 From: toto975 <104444110+toto975@users.noreply.github.com> Date: Tue, 27 Jun 2023 14:42:09 +0200 Subject: [PATCH] Keep original media filename after upload with Media Picker --- src/Http/Controllers/VoyagerMediaController.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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'));