From 46edea50d6c78638eb76816be7ff25981b662c9a Mon Sep 17 00:00:00 2001 From: Maikel Linke Date: Thu, 3 Feb 2022 00:26:34 +0000 Subject: [PATCH] Provide aws-sdk with working URI.encode method The S3 class is calling URI.encode which is removed in Ruby 3. By providing a URI module within the S3 class makes the S3 code call that module instead. (cherry picked from commit 2e6d8c12161d918940d02c8800b0ac41757b2a47) --- config/initializers/aws_sdk.rb | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 config/initializers/aws_sdk.rb diff --git a/config/initializers/aws_sdk.rb b/config/initializers/aws_sdk.rb new file mode 100644 index 0000000000..cf49dc9bb5 --- /dev/null +++ b/config/initializers/aws_sdk.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: false + +if AWS::VERSION == "1.67.0" + module AWS + module Core + module Signers + # @api private + class S3 + module URI + def self.escape(string) + ::URI::RFC2396_Parser.new.escape(string) + end + end + end + end + end + end +else + Rails.logger.warn "The aws-sdk patch needs updating or removing." +end