kt-paperclip 6.3.0 → 6.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/FUNDING.yml +3 -0
- data/.hound.yml +1 -1
- data/.travis.yml +7 -0
- data/README.md +1 -1
- data/lib/paperclip/io_adapters/http_url_proxy_adapter.rb +2 -2
- data/lib/paperclip/io_adapters/uri_adapter.rb +1 -1
- data/lib/paperclip/schema.rb +2 -2
- data/lib/paperclip/url_generator.rb +8 -1
- data/lib/paperclip/version.rb +1 -1
- data/spec/paperclip/io_adapters/http_url_proxy_adapter_spec.rb +20 -15
- data/spec/paperclip/storage/s3_spec.rb +1 -3
- data/spec/paperclip/url_generator_spec.rb +10 -0
- data/spec/support/model_reconstruction.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ff919875bc708cb71a8aa4d23b799de1d78db5bcc9b3ea67681d3a8bde2b52f8
|
4
|
+
data.tar.gz: 4c68f86a643f7dd52ed167a8e1b447770fdd8bea4c9a462265e42fefca235125
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7646e2ae1e2770a48d322d765ace1b0afcea3d4d0da1c2cceab6d97a70e2c562d6c115532373723152f2bd2a2e028a4c68739d5ef5b3e699d9a502c148c0bdc2
|
7
|
+
data.tar.gz: c6cebbef6816c9b987a4806a7a1581b213e882d7f8179fb19845f80650622253f27e2a85412ca61743153295ccd09863ac676bbec2a7771555eb750703458a20
|
data/.github/FUNDING.yml
ADDED
data/.hound.yml
CHANGED
@@ -1040,7 +1040,7 @@ Lint/UselessAssignment:
|
|
1040
1040
|
Description: Checks for useless assignment to a local variable.
|
1041
1041
|
StyleGuide: https://github.com/bbatsov/ruby-style-guide#underscore-unused-vars
|
1042
1042
|
Enabled: true
|
1043
|
-
Lint/
|
1043
|
+
Lint/BinaryOperatorWithIdenticalOperands:
|
1044
1044
|
Description: Checks for comparison of something with itself.
|
1045
1045
|
Enabled: true
|
1046
1046
|
Lint/UselessElseWithoutRescue:
|
data/.travis.yml
CHANGED
@@ -6,6 +6,7 @@ rvm:
|
|
6
6
|
- 2.4
|
7
7
|
- 2.5
|
8
8
|
- 2.6
|
9
|
+
- 2.7
|
9
10
|
|
10
11
|
script: "bundle exec rake clean spec cucumber"
|
11
12
|
|
@@ -36,3 +37,9 @@ matrix:
|
|
36
37
|
rvm: 2.3
|
37
38
|
- gemfile: gemfiles/6.0.gemfile
|
38
39
|
rvm: 2.4
|
40
|
+
- gemfile: gemfiles/4.2.gemfile
|
41
|
+
rvm: 2.7
|
42
|
+
- gemfile: gemfiles/5.0.gemfile
|
43
|
+
rvm: 2.7
|
44
|
+
- gemfile: gemfiles/5.1.gemfile
|
45
|
+
rvm: 2.7
|
data/README.md
CHANGED
@@ -171,7 +171,7 @@ Paperclip is distributed as a gem, which is how it should be used in your app.
|
|
171
171
|
Include the gem in your Gemfile:
|
172
172
|
|
173
173
|
```ruby
|
174
|
-
gem "kt-paperclip", "~> 6.
|
174
|
+
gem "kt-paperclip", "~> 6.3"
|
175
175
|
```
|
176
176
|
|
177
177
|
Or, if you want to get the latest, you can get master from the main paperclip repository:
|
@@ -9,8 +9,8 @@ module Paperclip
|
|
9
9
|
REGEXP = /\Ahttps?:\/\//.freeze
|
10
10
|
|
11
11
|
def initialize(target, options = {})
|
12
|
-
escaped =
|
13
|
-
super(URI(target ==
|
12
|
+
escaped = Paperclip::UrlGenerator.escape(target)
|
13
|
+
super(URI(target == Paperclip::UrlGenerator.unescape(target) ? escaped : target), options)
|
14
14
|
end
|
15
15
|
end
|
16
16
|
end
|
data/lib/paperclip/schema.rb
CHANGED
@@ -26,7 +26,7 @@ module Paperclip
|
|
26
26
|
attachment_names.each do |attachment_name|
|
27
27
|
COLUMNS.each_pair do |column_name, column_type|
|
28
28
|
column_options = options.merge(options[column_name.to_sym] || {})
|
29
|
-
add_column(table_name, "#{attachment_name}_#{column_name}", column_type, column_options)
|
29
|
+
add_column(table_name, "#{attachment_name}_#{column_name}", column_type, **column_options)
|
30
30
|
end
|
31
31
|
end
|
32
32
|
end
|
@@ -55,7 +55,7 @@ module Paperclip
|
|
55
55
|
attachment_names.each do |attachment_name|
|
56
56
|
COLUMNS.each_pair do |column_name, column_type|
|
57
57
|
column_options = options.merge(options[column_name.to_sym] || {})
|
58
|
-
column("#{attachment_name}_#{column_name}", column_type, column_options)
|
58
|
+
column("#{attachment_name}_#{column_name}", column_type, **column_options)
|
59
59
|
end
|
60
60
|
end
|
61
61
|
end
|
@@ -3,6 +3,13 @@ require "active_support/core_ext/module/delegation"
|
|
3
3
|
|
4
4
|
module Paperclip
|
5
5
|
class UrlGenerator
|
6
|
+
class << self
|
7
|
+
def encoder
|
8
|
+
@encoder ||= URI::RFC2396_Parser.new
|
9
|
+
end
|
10
|
+
delegate :escape, :unescape, to: :encoder
|
11
|
+
end
|
12
|
+
|
6
13
|
def initialize(attachment)
|
7
14
|
@attachment = attachment
|
8
15
|
end
|
@@ -65,7 +72,7 @@ module Paperclip
|
|
65
72
|
if url.respond_to?(:escape)
|
66
73
|
url.escape
|
67
74
|
else
|
68
|
-
|
75
|
+
self.class.escape(url).gsub(escape_regex) { |m| "%#{m.ord.to_s(16).upcase}" }
|
69
76
|
end
|
70
77
|
end
|
71
78
|
|
data/lib/paperclip/version.rb
CHANGED
@@ -16,54 +16,59 @@ describe Paperclip::HttpUrlProxyAdapter do
|
|
16
16
|
context "a new instance" do
|
17
17
|
before do
|
18
18
|
@url = "http://thoughtbot.com/images/thoughtbot-logo.png"
|
19
|
-
@subject = Paperclip.io_adapters.for(@url, hash_digest: Digest::MD5)
|
20
19
|
end
|
21
20
|
|
21
|
+
subject { Paperclip.io_adapters.for(@url, hash_digest: Digest::MD5) }
|
22
|
+
|
22
23
|
after do
|
23
|
-
|
24
|
+
subject.close
|
24
25
|
end
|
25
26
|
|
26
27
|
it "returns a file name" do
|
27
|
-
|
28
|
+
expect(subject.original_filename).to(eq("thoughtbot-logo.png"))
|
28
29
|
end
|
29
30
|
|
30
31
|
it "closes open handle after reading" do
|
31
|
-
|
32
|
+
expect { subject }.to(change { @open_return.closed? }.from(false).to(true))
|
32
33
|
end
|
33
34
|
|
34
35
|
it "returns a content type" do
|
35
|
-
|
36
|
+
expect(subject.content_type).to(eq("image/png"))
|
36
37
|
end
|
37
38
|
|
38
39
|
it "returns the size of the data" do
|
39
|
-
|
40
|
+
expect(subject.size).to(eq(@open_return.size))
|
40
41
|
end
|
41
42
|
|
42
43
|
it "generates an MD5 hash of the contents" do
|
43
|
-
|
44
|
+
expect(subject.fingerprint).to(eq(Digest::MD5.hexdigest("xxx")))
|
44
45
|
end
|
45
46
|
|
46
47
|
it "generates correct fingerprint after read" do
|
47
|
-
fingerprint = Digest::MD5.hexdigest(
|
48
|
-
|
48
|
+
fingerprint = Digest::MD5.hexdigest(subject.read)
|
49
|
+
expect(subject.fingerprint).to(eq(fingerprint))
|
49
50
|
end
|
50
51
|
|
51
52
|
it "generates same fingerprint" do
|
52
|
-
|
53
|
+
expect(subject.fingerprint).to(eq(subject.fingerprint))
|
53
54
|
end
|
54
55
|
|
55
56
|
it "returns the data contained in the StringIO" do
|
56
|
-
|
57
|
+
expect(subject.read).to(eq("xxx"))
|
57
58
|
end
|
58
59
|
|
59
60
|
it "accepts a content_type" do
|
60
|
-
|
61
|
-
|
61
|
+
subject.content_type = "image/png"
|
62
|
+
expect(subject.content_type).to(eq("image/png"))
|
62
63
|
end
|
63
64
|
|
64
65
|
it "accepts an original_filename" do
|
65
|
-
|
66
|
-
|
66
|
+
subject.original_filename = "image.png"
|
67
|
+
expect(subject.original_filename).to(eq("image.png"))
|
68
|
+
end
|
69
|
+
|
70
|
+
it "doesn't emit deprecation warnings" do
|
71
|
+
expect { subject }.to_not(output(/URI\.(un)?escape is obsolete/).to_stderr)
|
67
72
|
end
|
68
73
|
end
|
69
74
|
|
@@ -194,6 +194,16 @@ describe Paperclip::UrlGenerator do
|
|
194
194
|
"expected the interpolator to be passed #{expected.inspect} but it wasn't"
|
195
195
|
end
|
196
196
|
|
197
|
+
it "doesn't emit deprecation warnings" do
|
198
|
+
expected = "the expected result"
|
199
|
+
mock_interpolator = MockInterpolator.new(result: expected)
|
200
|
+
options = { interpolator: mock_interpolator }
|
201
|
+
mock_attachment = MockAttachment.new(options)
|
202
|
+
url_generator = Paperclip::UrlGenerator.new(mock_attachment)
|
203
|
+
|
204
|
+
expect { url_generator.for(:style_name, escape: true) }.to_not(output(/URI\.(un)?escape is obsolete/).to_stderr)
|
205
|
+
end
|
206
|
+
|
197
207
|
describe "should be able to escape (, ), [, and ]." do
|
198
208
|
def generate(expected, updated_at = nil)
|
199
209
|
mock_interpolator = MockInterpolator.new(result: expected)
|
@@ -28,7 +28,7 @@ module ModelReconstruction
|
|
28
28
|
|
29
29
|
def reset_table(_table_name, &block)
|
30
30
|
block ||= lambda { |_table| true }
|
31
|
-
ActiveRecord::Base.connection.create_table :dummies, { force: true }, &block
|
31
|
+
ActiveRecord::Base.connection.create_table :dummies, **{ force: true }, &block
|
32
32
|
end
|
33
33
|
|
34
34
|
def modify_table(&block)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kt-paperclip
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.
|
4
|
+
version: 6.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Surendra Singhi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-12-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|
@@ -354,6 +354,7 @@ extensions: []
|
|
354
354
|
extra_rdoc_files: []
|
355
355
|
files:
|
356
356
|
- ".codeclimate.yml"
|
357
|
+
- ".github/FUNDING.yml"
|
357
358
|
- ".github/ISSUE_TEMPLATE/bug_report.md"
|
358
359
|
- ".github/ISSUE_TEMPLATE/custom.md"
|
359
360
|
- ".github/ISSUE_TEMPLATE/feature_request.md"
|
@@ -583,8 +584,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
583
584
|
version: '0'
|
584
585
|
requirements:
|
585
586
|
- ImageMagick
|
586
|
-
|
587
|
-
rubygems_version: 2.7.9
|
587
|
+
rubygems_version: 3.0.1
|
588
588
|
signing_key:
|
589
589
|
specification_version: 4
|
590
590
|
summary: File attachments as attributes for ActiveRecord
|