Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

S3 file path error after uploading #137

Open
eugene-chernyshenko opened this issue May 1, 2020 · 8 comments
Open

S3 file path error after uploading #137

eugene-chernyshenko opened this issue May 1, 2020 · 8 comments

Comments

@eugene-chernyshenko
Copy link

I get invalid path to file uploading file to s3

Steps to reproduce:

  1. Press "add link"
  2. Upload file
  3. Choose file

You will get a link like "/elfinder/connect?path=&_csrf=0OgzayMV76bwOyMdP1pBN6nkEa-FGrPo6iAZh7lLemjimF0obkCV4KhPbmxyFght3oZk7bVK0YOoZUHP1xRPWA%3D%3D&cmd=file&target=fls1_enhjLnR4dA"

But if you do these steps without uploading you will get expected link

@eugene-chernyshenko
Copy link
Author

Screen Shot 2020-05-01 at 04 05 40

@eugene-chernyshenko
Copy link
Author

Screen Shot 2020-05-01 at 04 06 04

@MihailDev
Copy link
Owner

please show you config file (dont forgot hide credencials)

@eugene-chernyshenko
Copy link
Author

'controllerMap' => [
        'elfinder' => [
            'class' => 'mihaildev\elfinder\PathController',
            'access' => ['@'],
            'root' => [
                'class' => 'mihaildev\elfinder\flysystem\Volume',
                'url' => 'https://' . getenv('S3_BUCKET') .'.ams3.digitaloceanspaces.com/files',
                'component' => [
                    'class' => 'creocoder\flysystem\AwsS3Filesystem',
                    'key' => getenv('S3_ACCESS_KEY'),
                    'secret' => getenv('S3_ACCESS_SECRET'),
                    'bucket' => getenv('S3_BUCKET'),
                    'region' => getenv('S3_REGION'),
                    // 'version' => 'latest',
                    // 'baseUrl' => 'your-base-url',
                    'prefix' => 'files',
                    'options' => [
                        "ACL" => "public-read",
                    ],
                    'endpoint' => getenv('S3_ENDPOINT'),
                ],
            ],
        ],
    ],

@eugene-chernyshenko
Copy link
Author

"require": {
        "php": ">=7.0",
        ...
        "mihaildev/yii2-elfinder": "*",
        "mihaildev/yii2-ckeditor": "*",
        "creocoder/yii2-flysystem": "0.9.4 as 0.8.1",
        "mihaildev/yii2-elfinder-flysystem": "*"
    },

@eugene-chernyshenko
Copy link
Author

eugene-chernyshenko commented May 2, 2020

I had to hack a yii2-flysystem version using alias cause there is no way to set s3 endpoint in 0.8.1 version but 0.9.4 brokes dependencies

@eugene-chernyshenko
Copy link
Author

@MihailDev any ideas?

@MihailDev
Copy link
Owner

fix version
MihailDev/yii2-elfinder-flysystem@74227f5

i dont test all drivers
but I think you need to configure the baseUrl parameter for the component

sorry for the long answer i have health problems.
If you solve the problem, write how you will do it.
Thanks in advance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants