I have a situation where images are stored to s3 with flysystem_s3 but thumbnails are stored to local public files folder. After updating from 10.2.7 to 10.3.6 thumbnails start to fail due to this scheme check
if ($required_derivative_scheme !== $derivative_scheme) {
throw new AccessDeniedHttpException("3The scheme for this image doesn't match the scheme for the original image". print_r($derivative_scheme,true).print_r($required_derivative_scheme,true));
}
Original image is s3 scheme and thumbnail is public. Any ideas how can I keep my thumbnails in public files while actual resources are in s3?
@Eli-T
I was trying to add https://www.drupal.org/files/issues/2023-06-01/flysystem_s3-d10compatibi... → which is uploaded in this thread to drupal/flysystem_s3 loaded with composer.
The patch you linked looks quite a different. Will get back to this one.
Hey I had issues applying the patch. There are some minor differences between drupal.org version and git version. I made version that works on drupal.org version but for some reason I am not able to attach it. The issue seemed to be info files comments added in drupal.org.
diff --git a/composer.json b/composer.json
index 20f49c5..b0268ff 100644
--- a/composer.json
+++ b/composer.json
@@ -1,9 +1,9 @@
{
"name": "drupal/flysystem_s3",
"require": {
- "drupal/flysystem": "^2.0",
+ "drupal/flysystem": "^2.1@rc",
"league/flysystem": "^1.0.20",
"league/flysystem-aws-s3-v3": "^1.0, !=1.0.12, !=1.0.13",
- "drupal/core": "^9.0"
+ "drupal/core": "^9 || ^10"
}
}
diff --git a/flysystem_s3.info.yml b/flysystem_s3.info.yml
index ba73fc3..4f38efc 100644
--- a/flysystem_s3.info.yml
+++ b/flysystem_s3.info.yml
@@ -1,11 +1,11 @@
name: Flysystem Amazon S3
description: 'Provides an Amazon S3 plugin for Flysystem.'
type: module
-core_version_requirement: ^9
+core_version_requirement: ^9 || ^10.0
# version: 8.0-dev
package: Flysystem
dependencies:
- - flysystem:flysystem
+ - flysystem:flysystem
# Information added by Drupal.org packaging script on 2022-03-25
version: '2.0.0-rc5'
diff --git a/flysystem_s3.routing.yml b/flysystem_s3.routing.yml
index 0bc1cb8..2d271a2 100644
--- a/flysystem_s3.routing.yml
+++ b/flysystem_s3.routing.yml
@@ -4,11 +4,11 @@ flysystem_s3.cors_sign:
_controller: 'Drupal\flysystem_s3\Controller\S3CorsUploadAjaxController::signRequest'
requirements:
_permission: 'use S3 CORS upload'
- _method: 'POST'
+ methods: [POST]
flysystem_s3.cors_save:
path: '/flysystem-s3/cors-upload-save'
defaults:
_controller: 'Drupal\flysystem_s3\Controller\S3CorsUploadAjaxController::saveFile'
requirements:
_permission: 'use S3 CORS upload'
- _method: 'POST'
+ methods: [POST]
diff --git a/flysystem_s3.services.yml b/flysystem_s3.services.yml
index e36dc60..f209a3f 100644
--- a/flysystem_s3.services.yml
+++ b/flysystem_s3.services.yml
@@ -1,6 +1,6 @@
services:
flysystem_s3.file_system:
public: false
- class: \Drupal\flysystem_s3\File\FlysystemS3FileSystem
+ class: Drupal\flysystem_s3\File\FlysystemS3FileSystem
decorates: file_system
arguments: ['@stream_wrapper_manager', '@settings', '@logger.channel.file']
diff --git a/tests/src/Functional/ModuleInstallUninstallWebTest.php b/tests/src/Functional/ModuleInstallUninstallWebTest.php
index b33704d..755b9a4 100644
--- a/tests/src/Functional/ModuleInstallUninstallWebTest.php
+++ b/tests/src/Functional/ModuleInstallUninstallWebTest.php
@@ -14,6 +14,6 @@ class ModuleInstallUninstallWebTest extends Base {
/**
* {@inheritdoc}
*/
- public static $modules = ['flysystem_s3'];
+ protected static $modules = ['flysystem_s3'];
}
diff --git a/tests/src/Unit/Flysystem/S3Test.php b/tests/src/Unit/Flysystem/S3Test.php
index c574a71..b772102 100644
--- a/tests/src/Unit/Flysystem/S3Test.php
+++ b/tests/src/Unit/Flysystem/S3Test.php
@@ -13,6 +13,7 @@ use Drupal\flysystem_s3\Flysystem\S3;
use League\Flysystem\AdapterInterface;
use League\Flysystem\Config;
use Prophecy\Argument;
+use Prophecy\PhpUnit\ProphecyTrait;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\RequestStack;
@@ -23,6 +24,7 @@ use Symfony\Component\HttpFoundation\RequestStack;
*/
class S3Test extends UnitTestCase {
+ use ProphecyTrait;
/**
* @covers ::__construct
* @covers ::getExternalUrl