mirror of
https://github.com/kemko/paperclip.git
synced 2026-01-01 16:05:40 +03:00
Merge pull request #70 from insales/parse_with_addrassable
Используем Addressable для эскейпинга URLов
This commit is contained in:
2
Gemfile
2
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'
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
0
test/fixtures/кириллица.txt
vendored
Normal file
0
test/fixtures/кириллица.txt
vendored
Normal file
@@ -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? }
|
||||
|
||||
Reference in New Issue
Block a user