diff --git a/Gemfile b/Gemfile index 1da55fc..4c08290 100644 --- a/Gemfile +++ b/Gemfile @@ -24,6 +24,8 @@ gem 'thoughtbot-shoulda', '>= 2.9.0' gem 'pry' gem 'pry-byebug' +gem 'addressable' + group :lint do gem 'rubocop', '0.81.0' gem 'rubocop-rails', '2.5.2' diff --git a/gemfiles/rails_52.gemfile b/gemfiles/rails_52.gemfile index f6ba57d..c1e278e 100644 --- a/gemfiles/rails_52.gemfile +++ b/gemfiles/rails_52.gemfile @@ -15,6 +15,7 @@ gem "mocha" gem "thoughtbot-shoulda", ">= 2.9.0" gem "pry" gem "pry-byebug" +gem "addressable" group :lint do gem "rubocop", "0.81.0" diff --git a/gemfiles/rails_60.gemfile b/gemfiles/rails_60.gemfile index e66a8d2..7f744cd 100644 --- a/gemfiles/rails_60.gemfile +++ b/gemfiles/rails_60.gemfile @@ -15,6 +15,7 @@ gem "mocha" gem "thoughtbot-shoulda", ">= 2.9.0" gem "pry" gem "pry-byebug" +gem "addressable" group :lint do gem "rubocop", "0.81.0" diff --git a/gemfiles/rails_61.gemfile b/gemfiles/rails_61.gemfile index 1013798..c40e2b6 100644 --- a/gemfiles/rails_61.gemfile +++ b/gemfiles/rails_61.gemfile @@ -15,6 +15,7 @@ gem "mocha" gem "thoughtbot-shoulda", ">= 2.9.0" gem "pry" gem "pry-byebug" +gem "addressable" group :lint do gem "rubocop", "0.81.0" diff --git a/gemfiles/rails_70.gemfile b/gemfiles/rails_70.gemfile index 393cbbc..c1e4784 100644 --- a/gemfiles/rails_70.gemfile +++ b/gemfiles/rails_70.gemfile @@ -15,6 +15,7 @@ gem "mocha" gem "thoughtbot-shoulda", ">= 2.9.0" gem "pry" gem "pry-byebug" +gem "addressable" group :lint do gem "rubocop", "0.81.0" diff --git a/lib/paperclip/storage/no_cache_s3.rb b/lib/paperclip/storage/no_cache_s3.rb index 5177002..f56b573 100644 --- a/lib/paperclip/storage/no_cache_s3.rb +++ b/lib/paperclip/storage/no_cache_s3.rb @@ -180,7 +180,7 @@ module Paperclip # К ссылке, сформированной по паттерну (например, через наш CDN), добавляем параметры с подписью def presigned_url(style) - uri = URI.parse(CGI.escape(storage_url(style))) + uri = URI.parse(Addressable::URI.escape(storage_url(style))) basic_params = CGI.parse(uri.query || '') presign_params = CGI.parse(URI.parse(self.class.store_by(self.class.main_store_id).object(key(style)) .presigned_url(:get)).query) diff --git a/paperclip.gemspec b/paperclip.gemspec index 2f3e74e..834461d 100644 --- a/paperclip.gemspec +++ b/paperclip.gemspec @@ -17,5 +17,6 @@ Gem::Specification.new do |s| s.summary = %q{File attachments as attributes for ActiveRecord} s.add_dependency 'activesupport', '< 7.1' + s.add_dependency 'addressable' s.add_dependency 'fastimage' end diff --git a/test/fixtures/кириллица.txt b/test/fixtures/кириллица.txt new file mode 100644 index 0000000..e69de29 diff --git a/test/storage/no_cache_s3_test.rb b/test/storage/no_cache_s3_test.rb index 8288327..8e7fe9a 100644 --- a/test/storage/no_cache_s3_test.rb +++ b/test/storage/no_cache_s3_test.rb @@ -41,7 +41,7 @@ class NoCacheS3Test < Test::Unit::TestCase @store1_stub.stubs(:url).returns('http://store.local') @store2_stub.stubs(:url).returns('http://store.local') @instance.avatar.class.stubs(:stores).returns({ store_1: @store1_stub, store_2: @store2_stub }) - Dummy::AvatarAttachment.any_instance.stubs(:to_file).returns(stub_file('test.txt', 'qwe')) + Dummy::AvatarAttachment.any_instance.stubs(:to_file).returns(stub_file('кириллица.txt', 'qwe')) end teardown { TEST_ROOT.rmtree if TEST_ROOT.exist? }