@@ -16,13 +16,9 @@ final class S3Uploader extends AbstractFileUploader
1616    /** @var string */ 
1717    private  $ s3Bucket
1818
19-     /** @var string */ 
20-     private  $ baseUrl
21- 
2219    /** 
2320     * @param S3Client            $s3Client 
2421     * @param string              $s3Bucket 
25-      * @param string              $baseUrl 
2622     * @param ValidatorInterface  $validator 
2723     * @param TranslatorInterface $translator 
2824     * @param string              $mimeTypesExtensions 
@@ -33,7 +29,6 @@ final class S3Uploader extends AbstractFileUploader
3329    public  function  __construct (
3430        S3Client $ s3Client
3531        string  $ s3Bucket
36-         string  $ baseUrl
3732        ValidatorInterface $ validator
3833        TranslatorInterface $ translator
3934        string  $ mimeTypesExtensions
@@ -43,7 +38,6 @@ public function __construct(
4338    ) {
4439        $ this s3Client  = $ s3Client
4540        $ this s3Bucket  = $ s3Bucket
46-         $ this baseUrl  = $ baseUrl
4741
4842        parent ::__construct ($ validator$ translator$ mimeTypesExtensions$ mimeTypesTypes$ maxFilesize$ imageDriver
4943    }
@@ -203,6 +197,12 @@ public function getFileSize(string $fileName): ?int
203197     */ 
204198    private  function  cleanFileName (string  $ fileNamestring 
205199    {
206-         return  substr ($ fileNamestrpos ($ fileName$ this baseUrl ));
200+         $ fileNameparse_url ($ fileNamePHP_URL_PATH );
201+ 
202+         if  ('/ '  === substr ($ fileName0 , 1 )) {
203+             $ fileNamesubstr ($ fileName1 );
204+         }
205+ 
206+         return  $ fileName
207207    }
208208}
0 commit comments