Skip to content

Instantly share code, notes, and snippets.

@noah-st-amand
Created November 17, 2023 23:16
Show Gist options
  • Save noah-st-amand/573df038c805942165b836f1d9688b66 to your computer and use it in GitHub Desktop.
Save noah-st-amand/573df038c805942165b836f1d9688b66 to your computer and use it in GitHub Desktop.
add-manual-autoload-2871616-6.patch
diff --git a/S3fsStreamWrapper.inc b/S3fsStreamWrapper.inc
index c5b970f..fbf1576 100644
--- a/S3fsStreamWrapper.inc
+++ b/S3fsStreamWrapper.inc
@@ -14,6 +14,13 @@ if (!module_exists('composer_manager')) {
_s3fs_load_awssdk_library();
}
+// Work around the fact that this file may run before /vendor/autoloader.php,
+// generating a "class not found" error. See:
+// https://www.drupal.org/project/s3fs/issues/2871616#comment-15322671
+if (!class_exists('Aws\Sdk')) {
+ require_once DRUPAL_ROOT . '/../vendor/autoload.php';
+}
+
use Aws\CacheInterface;
use Aws\S3\Exception\S3Exception;
use Aws\S3\StreamWrapper;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment