]> _ Git - cubist_cms-back.git/commitdiff
wip #4791 @0.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 14 Oct 2021 17:07:47 +0000 (19:07 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 14 Oct 2021 17:07:47 +0000 (19:07 +0200)
src/app/Magic/Controllers/CubistMagicController.php

index 38b462f1f1ab8576ac95cf43268315ae8eceb77f..c40993fbf03cd8d5a9aba6f7b82dcca1a568a3ee 100644 (file)
@@ -361,12 +361,8 @@ class CubistMagicController extends CubistCrudController
         /** @var Media $media */
         /** @var UploadedFile $file */
         $file = request()->files->get('file');
-        $e = explode('.', $file->getFilename());
-        $ext = array_pop($e);
-        $fname = implode('.', $e);
-        $fname = Str::slug($fname);
 
-        $nfile = new UploadedFile($file->getPathname(), $fname . '.' . $ext, $file->getMimeType(), $file->getError());
+        $nfile = new UploadedFile($file->getPathname(), Str::slug($file->getClientOriginalName()) . '.' . $file->getClientOriginalExtension(), $file->getMimeType(), $file->getError());
         request()->files->set('file', $nfile);
 
         $media = $entry->addMediaFromRequest('file')->toMediaCollection($request->input('collection'));