Commit 8e0c9c83 authored by imiksu's avatar imiksu Committed by Leon Kessler
Browse files

Issue #3172969 by iMiksu: file stat/size/download broken with flysystem-aws-s3-v3:1.0.28+

parent 079702cc
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@

namespace Drupal\flysystem_s3\Flysystem\Adapter;

use Aws\S3\S3ClientInterface;
use League\Flysystem\AdapterInterface;
use League\Flysystem\AwsS3v3\AwsS3Adapter;
use League\Flysystem\Config;
@@ -13,6 +14,20 @@ use League\Flysystem\Util\MimeType;
 */
class S3Adapter extends AwsS3Adapter {

  /**
   * {@inheritdoc}
   */
  public function __construct(S3ClientInterface $client, $bucket, $prefix = '', array $options = [], $streamReads = TRUE) {
    // In order to stat files by specifying non-streaming http option which has
    // become default setting as of league/flysystem-aws-s3-v3 version 1.0.25.
    // @see https://www.drupal.org/project/flysystem_s3/issues/3172969
    if (!isset($options['@http']['stream'])) {
      $options['@http']['stream'] = FALSE;
    }

    parent::__construct($client, $bucket, $prefix, $options, $streamReads);
  }

  /**
   * {@inheritdoc}
   */