Shopsys: Elfinder bug for s3 service

Created on 18 Aug 2019  路  4Comments  路  Source: shopsys/shopsys

What is happening

There is a bug in https://github.com/barryvdh/elfinder-flysystem-driver package, that overrides default service and removes permissions for a file. See https://github.com/barryvdh/elfinder-flysystem-driver/issues/73

This creates problems with s3 service, because we need to set permission for every file. Because SSFW overrides original file with that method I have no idea, how to override your class and fix this issue.

Expected result

I'm able to save the file to s3 with correct permissions.

Infrastructure Stale

Most helpful comment

Hi @henzigo,

thanks for filling the issue. First I wanted to include some fix into the framework and I was able to come with several ways how to fix it, but none of them was "good".

  1. Create a fix in https://github.com/barryvdh/elfinder-flysystem-driver and wait for the new release.
    I created PR https://github.com/barryvdh/elfinder-flysystem-driver/pull/75, but the last release was in 2017, so fingers crossed.
  2. We can fork the library and take care of it, but honestly that's not what I want to do unless absolutelly necessary.
  3. Override the init method in our implementation in VolumeDriver class, but do it without thorough testing and deeply understanding the problem (how the plugins works? what is glideUrl and how to work with it? and more) is unpleasant to me
  4. Find or write another connector.... please don't
  5. Set $this->options['cache'] to false (disable caching completely) in our init method. Do we really want to disable caching for everyone, when one specific use case causes problem?

I assume your filesystem is configured somehow like this

$s3Adapter = new AwsS3Adapter($s3Client, $bucketName);

return new Filesystem($s3Adapter, [
    'visibility' => AdapterInterface::VISIBILITY_PUBLIC,
]);

And this cause troubles because elfinder-flysystem-driver drops the visibility configuration.

Sn铆mek obrazovky 2019-08-19 v聽14 00 47

You can however create filesystem with cached adapter and bypass the creating cached one in elfinder-flysystem-driver library.

Something like this works:

  $s3Adapter = new AwsS3Adapter($s3Client, $bucketName);

+ $cachedAdapter = new CachedAdapter($s3Adapter, new \League\Flysystem\Cached\Storage\Memory());

- return new Filesystem($s3Adapter, [
+ return new Filesystem($cachedAdapter, [
    'visibility' => AdapterInterface::VISIBILITY_PUBLIC,
]);

Sn铆mek obrazovky 2019-08-19 v聽14 06 43

All 4 comments

Hi @henzigo,

thanks for filling the issue. First I wanted to include some fix into the framework and I was able to come with several ways how to fix it, but none of them was "good".

  1. Create a fix in https://github.com/barryvdh/elfinder-flysystem-driver and wait for the new release.
    I created PR https://github.com/barryvdh/elfinder-flysystem-driver/pull/75, but the last release was in 2017, so fingers crossed.
  2. We can fork the library and take care of it, but honestly that's not what I want to do unless absolutelly necessary.
  3. Override the init method in our implementation in VolumeDriver class, but do it without thorough testing and deeply understanding the problem (how the plugins works? what is glideUrl and how to work with it? and more) is unpleasant to me
  4. Find or write another connector.... please don't
  5. Set $this->options['cache'] to false (disable caching completely) in our init method. Do we really want to disable caching for everyone, when one specific use case causes problem?

I assume your filesystem is configured somehow like this

$s3Adapter = new AwsS3Adapter($s3Client, $bucketName);

return new Filesystem($s3Adapter, [
    'visibility' => AdapterInterface::VISIBILITY_PUBLIC,
]);

And this cause troubles because elfinder-flysystem-driver drops the visibility configuration.

Sn铆mek obrazovky 2019-08-19 v聽14 00 47

You can however create filesystem with cached adapter and bypass the creating cached one in elfinder-flysystem-driver library.

Something like this works:

  $s3Adapter = new AwsS3Adapter($s3Client, $bucketName);

+ $cachedAdapter = new CachedAdapter($s3Adapter, new \League\Flysystem\Cached\Storage\Memory());

- return new Filesystem($s3Adapter, [
+ return new Filesystem($cachedAdapter, [
    'visibility' => AdapterInterface::VISIBILITY_PUBLIC,
]);

Sn铆mek obrazovky 2019-08-19 v聽14 06 43

https://github.com/barryvdh/elfinder-flysystem-driver/pull/75 was merged to master, but a new version is not yet released.

This issue has been automatically marked as stale because there was no activity within the last 4 months (and it is quite a long time). It will be closed if no further activity occurs. Thank you for your contributions.

This issue has been automatically closed because there was no acivity within the last half a year.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ondrejbohac picture ondrejbohac  路  3Comments

vitek-rostislav picture vitek-rostislav  路  5Comments

simara-svatopluk picture simara-svatopluk  路  5Comments

TomasLudvik picture TomasLudvik  路  4Comments

grossmannmartin picture grossmannmartin  路  3Comments