helios-ag / FMElfinderBundle

:file_folder: ElFinderBundle provides ElFinder integration with TinyMCE, CKEditor, Summernote editors
MIT License
275 stars 128 forks source link

Duplicated Bucket Name in Endpoint URL #439

Closed lahmacun closed 3 years ago

lahmacun commented 3 years ago

Describe the bug While creating the endpoint url, bucket name is appending twice.

To Reproduce I'm using the version 9.3.2

This is my current config.

fm_elfinder:
    assets_path: /ckeditor-assets # default is /assets, this is where css/js elfinder files are
    instances:
        default:
            locale: '%locale%'
            editor: ckeditor
            relative_path: false
            visible_mime_types: ['image/png', 'image/jpg', 'image/jpeg', 'image/gif']
            connector:
                roots:
                    aws_s3:
                        driver: Flysystem
                        path: 'media/images/faq/photo'
                        url: 'https://%amazon_s3.bucket%.s3.%amazon_s3.region%.amazonaws.com/media/images/faq/photo'
                        tmb_url: 'self' # For thumbnail generation on aws
                        flysystem:
                            type: aws_s3_v3
                            options:
                                aws_s3_v3:
                                    version: 'latest'
                                    key: '%amazon_s3.key%'
                                    secret: '%amazon_s3.secret%'
                                    endpoint: 'http://%amazon_s3.bucket%.s3.%amazon_s3.region%.amazonaws.com'
                                    region: '%amazon_s3.region%'
                                    bucket_name: '%amazon_s3.bucket%'
                        upload_allow: [ 'all' ]

When I'm using this config, it fetches all files and directories but sometimes it does not. Also, I get this error everytime when I try to delete or rename a file.

Error executing "ListObjects" on "http://BUCKET_NAME.BUCKET_NAME.s3.eu-central-1.amazonaws.com/?prefix=media%2Fimages%2Ffaq%2Fphoto%2F&delimiter=%2F&encoding-type=url"; AWS HTTP error: Client error: `GET http://BUCKET_NAME.BUCKET_NAME.s3.eu-central-1.amazonaws.com/?prefix=media%2Fimages%2Ffaq%2Fphoto%2F&delimiter=%2F&encoding-type=url` resulted in a 404 Not Found

Somehow, it's writing the bucket name twice while generating the endpoint url. I'm not sure if it's misconfiguration or bug. Do I missing something?

Best Regards, Zahid.

lahmacun commented 3 years ago

If I get an error while listing, I comment out the bucket_name in my config, refresh the page and listing is working now. If I re enable the bucket_name and refresh the page, it still works. But when I try to delete a file, it brakes the listing again.

lahmacun commented 3 years ago

Sorry, it was my fault. I should've not add bucket name in endpoint name.