kt-paperclip 7.2.0 → 7.2.1
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/NEWS +2 -1
- data/lib/paperclip/geometry_detector_factory.rb +1 -1
- data/lib/paperclip/glue.rb +3 -2
- data/lib/paperclip/locales/gd.yml +20 -0
- data/lib/paperclip/media_type_spoof_detector.rb +2 -1
- data/lib/paperclip/validators/attachment_size_validator.rb +2 -2
- data/lib/paperclip/version.rb +1 -1
- data/spec/paperclip/geometry_detector_spec.rb +9 -0
- data/spec/paperclip/geometry_spec.rb +16 -4
- data/spec/paperclip/glue_spec.rb +21 -0
- data/spec/paperclip/io_adapters/uri_adapter_spec.rb +1 -1
- data/spec/paperclip/media_type_spoof_detector_spec.rb +10 -4
- data/spec/paperclip/paperclip_spec.rb +1 -1
- data/spec/paperclip/storage/s3_spec.rb +113 -50
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 206e4e7dd6b6f2ad56c7a0395e9b845a8033c7efa20f19f4ef5c33d09edcbf39
|
|
4
|
+
data.tar.gz: 492bfb36e312bd31c4511a91f6b0b4d779d31b5d098f616cb75871c2a6a4e527
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 86a39461732fd83389253cc444168d30a9af957362d90694e04852d86619e3d4ac4a84ea71db0d904784de74d5c5e019bdcec86fc18484fce2e26568cf390d55
|
|
7
|
+
data.tar.gz: 9506c9fc401cb9ccee3dcfe9186ec8787df2abdc3472f947592d7a79a2e6c32e917cc3eae2de1bfc49f366129a67f793c436b69ecafe501aee0fb7c265662bdc
|
data/NEWS
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
[UNRELEASED]
|
|
2
|
-
|
|
2
|
+
* Improvement: Support file extension names both as symbols and strings for :content_type_mappings
|
|
3
|
+
* Issue file delete only once per unique style when nullifying attachment or destroying an object. Avoids triggering a rate limit error on Google Cloud Storage.
|
|
3
4
|
|
|
4
5
|
7.0.0 (2021-05-28)
|
|
5
6
|
* Replace `mimemagic` gem with `marcel` due to licensing issues. See https://github.com/kreeti/kt-paperclip/pull/54 for details and limitations
|
|
@@ -7,7 +7,7 @@ module Paperclip
|
|
|
7
7
|
|
|
8
8
|
def make
|
|
9
9
|
geometry = GeometryParser.new(geometry_string.strip).make
|
|
10
|
-
geometry || raise(Errors::NotIdentifiedByImageMagickError.new)
|
|
10
|
+
geometry || raise(Errors::NotIdentifiedByImageMagickError.new("Could not identify image size"))
|
|
11
11
|
end
|
|
12
12
|
|
|
13
13
|
private
|
data/lib/paperclip/glue.rb
CHANGED
|
@@ -4,14 +4,15 @@ require "paperclip/schema"
|
|
|
4
4
|
|
|
5
5
|
module Paperclip
|
|
6
6
|
module Glue
|
|
7
|
+
LOCALE_PATHS = Dir.glob("#{File.dirname(__FILE__)}/locales/*.{rb,yml}")
|
|
8
|
+
|
|
7
9
|
def self.included(base)
|
|
8
10
|
base.extend ClassMethods
|
|
9
11
|
base.send :include, Callbacks
|
|
10
12
|
base.send :include, Validators
|
|
11
13
|
base.send :include, Schema if defined? ActiveRecord::Base
|
|
12
14
|
|
|
13
|
-
|
|
14
|
-
I18n.load_path += locale_path unless I18n.load_path.include?(locale_path)
|
|
15
|
+
I18n.load_path += LOCALE_PATHS unless (LOCALE_PATHS - I18n.load_path).empty?
|
|
15
16
|
end
|
|
16
17
|
end
|
|
17
18
|
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
gd:
|
|
2
|
+
errors:
|
|
3
|
+
messages:
|
|
4
|
+
in_between: "– feumaidh seo a bhith eadar %{min} ’s %{max}"
|
|
5
|
+
spoofed_media_type: "– tha susbaint ann nach eil a-rèir na chaidh aithris"
|
|
6
|
+
|
|
7
|
+
number:
|
|
8
|
+
human:
|
|
9
|
+
storage_units:
|
|
10
|
+
format: "%n %u"
|
|
11
|
+
units:
|
|
12
|
+
byte:
|
|
13
|
+
one: "bhaidht"
|
|
14
|
+
two: "bhaidht"
|
|
15
|
+
few: "baidhtean"
|
|
16
|
+
other: "baidht"
|
|
17
|
+
kb: "KB"
|
|
18
|
+
mb: "MB"
|
|
19
|
+
gb: "GB"
|
|
20
|
+
tb: "TB"
|
|
@@ -82,7 +82,8 @@ module Paperclip
|
|
|
82
82
|
end
|
|
83
83
|
|
|
84
84
|
def mapped_content_type
|
|
85
|
-
Paperclip.options[:content_type_mappings]
|
|
85
|
+
content_type_mappings = Paperclip.options[:content_type_mappings]
|
|
86
|
+
content_type_mappings[filename_extension] || content_type_mappings[filename_extension.to_s]
|
|
86
87
|
end
|
|
87
88
|
|
|
88
89
|
def filename_extension
|
|
@@ -35,8 +35,8 @@ module Paperclip
|
|
|
35
35
|
options.slice(*AVAILABLE_CHECKS).each do |option, option_value|
|
|
36
36
|
option_value = option_value.call(record) if option_value.is_a?(Proc)
|
|
37
37
|
option_value = extract_option_value(option, option_value)
|
|
38
|
-
operator =
|
|
39
|
-
|
|
38
|
+
operator = ActiveModel::VERSION::MAJOR >= 7 ? COMPARE_CHECKS[option] : CHECKS[option]
|
|
39
|
+
|
|
40
40
|
unless value.send(operator, option_value)
|
|
41
41
|
error_message_key = options[:in] ? :in_between : option
|
|
42
42
|
error_attrs.each do |error_attr_name|
|
data/lib/paperclip/version.rb
CHANGED
|
@@ -35,4 +35,13 @@ describe Paperclip::GeometryDetector do
|
|
|
35
35
|
Paperclip.options[:use_exif_orientation] = true
|
|
36
36
|
end
|
|
37
37
|
end
|
|
38
|
+
|
|
39
|
+
it "raises an exception with a message when the file is not an image" do
|
|
40
|
+
file = fixture_file("text.txt")
|
|
41
|
+
factory = Paperclip::GeometryDetector.new(file)
|
|
42
|
+
|
|
43
|
+
expect do
|
|
44
|
+
factory.make
|
|
45
|
+
end.to raise_error(Paperclip::Errors::NotIdentifiedByImageMagickError, "Could not identify image size")
|
|
46
|
+
end
|
|
38
47
|
end
|
|
@@ -147,23 +147,35 @@ describe Paperclip::Geometry do
|
|
|
147
147
|
|
|
148
148
|
it "does not generate from a bad file" do
|
|
149
149
|
file = "/home/This File Does Not Exist.omg"
|
|
150
|
-
expect
|
|
150
|
+
expect do
|
|
151
|
+
@geo = Paperclip::Geometry.from_file(file)
|
|
152
|
+
end.to raise_error(Paperclip::Errors::NotIdentifiedByImageMagickError,
|
|
153
|
+
"Could not identify image size")
|
|
151
154
|
end
|
|
152
155
|
|
|
153
156
|
it "does not generate from a blank filename" do
|
|
154
157
|
file = ""
|
|
155
|
-
expect
|
|
158
|
+
expect do
|
|
159
|
+
@geo = Paperclip::Geometry.from_file(file)
|
|
160
|
+
end.to raise_error(Paperclip::Errors::NotIdentifiedByImageMagickError,
|
|
161
|
+
"Cannot find the geometry of a file with a blank name")
|
|
156
162
|
end
|
|
157
163
|
|
|
158
164
|
it "does not generate from a nil file" do
|
|
159
165
|
file = nil
|
|
160
|
-
expect
|
|
166
|
+
expect do
|
|
167
|
+
@geo = Paperclip::Geometry.from_file(file)
|
|
168
|
+
end.to raise_error(Paperclip::Errors::NotIdentifiedByImageMagickError,
|
|
169
|
+
"Cannot find the geometry of a file with a blank name")
|
|
161
170
|
end
|
|
162
171
|
|
|
163
172
|
it "does not generate from a file with no path" do
|
|
164
173
|
file = double("file", path: "")
|
|
165
174
|
allow(file).to receive(:respond_to?).with(:path).and_return(true)
|
|
166
|
-
expect
|
|
175
|
+
expect do
|
|
176
|
+
@geo = Paperclip::Geometry.from_file(file)
|
|
177
|
+
end.to raise_error(Paperclip::Errors::NotIdentifiedByImageMagickError,
|
|
178
|
+
"Cannot find the geometry of a file with a blank name")
|
|
167
179
|
end
|
|
168
180
|
|
|
169
181
|
it "lets us know when a command isn't found versus a processing error" do
|
data/spec/paperclip/glue_spec.rb
CHANGED
|
@@ -39,4 +39,25 @@ describe Paperclip::Glue do
|
|
|
39
39
|
Object.send :remove_const, "NonActiveRecordModel"
|
|
40
40
|
end
|
|
41
41
|
end
|
|
42
|
+
|
|
43
|
+
describe "when included" do
|
|
44
|
+
it "does not mutate I18n.load_path more than once" do
|
|
45
|
+
before_load_path = I18n.load_path
|
|
46
|
+
I18n.load_path = []
|
|
47
|
+
|
|
48
|
+
# expect twice because the load_path is reset after creating the classes
|
|
49
|
+
expect(I18n.config).to receive(:load_path=).and_call_original.twice
|
|
50
|
+
|
|
51
|
+
FirstModel = Class.new
|
|
52
|
+
FirstModel.include Paperclip::Glue
|
|
53
|
+
|
|
54
|
+
SecondModel = Class.new
|
|
55
|
+
SecondModel.include Paperclip::Glue
|
|
56
|
+
|
|
57
|
+
ThirdModel = Class.new
|
|
58
|
+
ThirdModel.include Paperclip::Glue
|
|
59
|
+
|
|
60
|
+
I18n.load_path = before_load_path
|
|
61
|
+
end
|
|
62
|
+
end
|
|
42
63
|
end
|
|
@@ -224,7 +224,7 @@ describe Paperclip::UriAdapter do
|
|
|
224
224
|
|
|
225
225
|
it "calls open with read_timeout option" do
|
|
226
226
|
expect(@uri_opener)
|
|
227
|
-
.to receive(:open).with(@uri, read_timeout: 120).at_least(1).times
|
|
227
|
+
.to receive(:open).with(@uri, { read_timeout: 120 }).at_least(1).times
|
|
228
228
|
end
|
|
229
229
|
end
|
|
230
230
|
end
|
|
@@ -32,12 +32,18 @@ describe Paperclip::MediaTypeSpoofDetector do
|
|
|
32
32
|
end
|
|
33
33
|
|
|
34
34
|
it "does not reject when the extension => content_type is in :content_type_mappings" do
|
|
35
|
+
file = Tempfile.open(["test", ".PEM"])
|
|
36
|
+
file.puts "Certificate!"
|
|
37
|
+
file.close
|
|
38
|
+
|
|
39
|
+
adapter = Paperclip.io_adapters.for(File.new(file.path))
|
|
40
|
+
|
|
35
41
|
begin
|
|
36
42
|
Paperclip.options[:content_type_mappings] = { pem: "text/plain" }
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
43
|
+
assert !Paperclip::MediaTypeSpoofDetector.using(adapter, adapter.original_filename, adapter.content_type).spoofed?
|
|
44
|
+
|
|
45
|
+
# As a string.
|
|
46
|
+
Paperclip.options[:content_type_mappings] = { "pem" => "text/plain" }
|
|
41
47
|
assert !Paperclip::MediaTypeSpoofDetector.using(adapter, adapter.original_filename, adapter.content_type).spoofed?
|
|
42
48
|
ensure
|
|
43
49
|
Paperclip.options[:content_type_mappings] = {}
|
|
@@ -63,7 +63,7 @@ describe Paperclip do
|
|
|
63
63
|
context "Calling Paperclip.run with a logger" do
|
|
64
64
|
it "passes the defined logger if :log_command is set" do
|
|
65
65
|
Paperclip.options[:log_command] = true
|
|
66
|
-
expect(Terrapin::CommandLine).to receive(:new).with("convert", "stuff", logger: Paperclip.logger).and_return(double(run: nil))
|
|
66
|
+
expect(Terrapin::CommandLine).to receive(:new).with("convert", "stuff", { logger: Paperclip.logger }).and_return(double(run: nil))
|
|
67
67
|
Paperclip.run("convert", "stuff")
|
|
68
68
|
end
|
|
69
69
|
end
|
|
@@ -395,12 +395,22 @@ describe Paperclip::Storage::S3 do
|
|
|
395
395
|
allow(@dummy.avatar).to receive(:s3_object).with(:thumbnail).and_return(object)
|
|
396
396
|
|
|
397
397
|
expect(object).to receive(:upload_file).
|
|
398
|
-
with(
|
|
399
|
-
|
|
398
|
+
with(
|
|
399
|
+
anything,
|
|
400
|
+
{
|
|
401
|
+
content_type: "image/png",
|
|
402
|
+
acl: :"public-read",
|
|
403
|
+
},
|
|
404
|
+
)
|
|
400
405
|
expect(object).to receive(:upload_file).
|
|
401
|
-
with(
|
|
402
|
-
|
|
403
|
-
|
|
406
|
+
with(
|
|
407
|
+
anything,
|
|
408
|
+
{
|
|
409
|
+
content_type: "image/png",
|
|
410
|
+
acl: :"public-read",
|
|
411
|
+
cache_control: "max-age=31557600",
|
|
412
|
+
},
|
|
413
|
+
)
|
|
404
414
|
@dummy.save
|
|
405
415
|
end
|
|
406
416
|
|
|
@@ -445,12 +455,12 @@ describe Paperclip::Storage::S3 do
|
|
|
445
455
|
it "uploads original" do
|
|
446
456
|
expect(@object).to receive(:upload_file).with(
|
|
447
457
|
anything,
|
|
448
|
-
content_type: "image/png",
|
|
458
|
+
{ content_type: "image/png" },
|
|
449
459
|
).and_return(true)
|
|
450
460
|
@dummy.avatar.reprocess!
|
|
451
461
|
expect(@object).to receive(:upload_file).with(
|
|
452
462
|
anything,
|
|
453
|
-
content_type: "image/png",
|
|
463
|
+
{ content_type: "image/png" },
|
|
454
464
|
).and_return(true)
|
|
455
465
|
@dummy.avatar.reprocess!
|
|
456
466
|
end
|
|
@@ -458,7 +468,7 @@ describe Paperclip::Storage::S3 do
|
|
|
458
468
|
it "doesn't upload original" do
|
|
459
469
|
expect(@object).to receive(:upload_file).with(
|
|
460
470
|
anything,
|
|
461
|
-
content_type: "image/png",
|
|
471
|
+
{ content_type: "image/png" },
|
|
462
472
|
).and_return(true)
|
|
463
473
|
@dummy.avatar.reprocess!
|
|
464
474
|
end
|
|
@@ -500,14 +510,18 @@ describe Paperclip::Storage::S3 do
|
|
|
500
510
|
it "uploads original" do
|
|
501
511
|
expect(@object).to receive(:upload_file).with(
|
|
502
512
|
anything,
|
|
503
|
-
|
|
504
|
-
|
|
513
|
+
{
|
|
514
|
+
content_type: "image/png",
|
|
515
|
+
acl: :"public-read",
|
|
516
|
+
},
|
|
505
517
|
).and_return(true)
|
|
506
518
|
@dummy.avatar.reprocess!
|
|
507
519
|
expect(@object).to receive(:upload_file).with(
|
|
508
520
|
anything,
|
|
509
|
-
|
|
510
|
-
|
|
521
|
+
{
|
|
522
|
+
content_type: "image/png",
|
|
523
|
+
acl: :"public-read",
|
|
524
|
+
},
|
|
511
525
|
).and_return(true)
|
|
512
526
|
@dummy.avatar.reprocess!
|
|
513
527
|
end
|
|
@@ -515,8 +529,10 @@ describe Paperclip::Storage::S3 do
|
|
|
515
529
|
it "doesn't upload original" do
|
|
516
530
|
expect(@object).to receive(:upload_file).with(
|
|
517
531
|
anything,
|
|
518
|
-
|
|
519
|
-
|
|
532
|
+
{
|
|
533
|
+
content_type: "image/png",
|
|
534
|
+
acl: :"public-read",
|
|
535
|
+
},
|
|
520
536
|
).and_return(true)
|
|
521
537
|
@dummy.avatar.reprocess!
|
|
522
538
|
end
|
|
@@ -725,7 +741,7 @@ describe Paperclip::Storage::S3 do
|
|
|
725
741
|
object = double
|
|
726
742
|
allow(@dummy.avatar).to receive(:s3_object).and_return(object)
|
|
727
743
|
|
|
728
|
-
expect(object).to receive(:presigned_url).with(:get, expires_in: 3600)
|
|
744
|
+
expect(object).to receive(:presigned_url).with(:get, { expires_in: 3600 })
|
|
729
745
|
@dummy.avatar.expiring_url
|
|
730
746
|
end
|
|
731
747
|
end
|
|
@@ -740,8 +756,13 @@ describe Paperclip::Storage::S3 do
|
|
|
740
756
|
object = double
|
|
741
757
|
allow(@dummy.avatar).to receive(:s3_object).and_return(object)
|
|
742
758
|
expect(object).to receive(:presigned_url).
|
|
743
|
-
with(
|
|
744
|
-
|
|
759
|
+
with(
|
|
760
|
+
:get,
|
|
761
|
+
{
|
|
762
|
+
expires_in: 3600,
|
|
763
|
+
response_content_disposition: "inline",
|
|
764
|
+
},
|
|
765
|
+
)
|
|
745
766
|
@dummy.avatar.expiring_url
|
|
746
767
|
end
|
|
747
768
|
end
|
|
@@ -763,7 +784,13 @@ describe Paperclip::Storage::S3 do
|
|
|
763
784
|
object = double
|
|
764
785
|
allow(@dummy.avatar).to receive(:s3_object).and_return(object)
|
|
765
786
|
expect(object).to receive(:presigned_url).
|
|
766
|
-
with(
|
|
787
|
+
with(
|
|
788
|
+
:get,
|
|
789
|
+
{
|
|
790
|
+
expires_in: 3600,
|
|
791
|
+
response_content_type: "image/png",
|
|
792
|
+
},
|
|
793
|
+
)
|
|
767
794
|
@dummy.avatar.expiring_url
|
|
768
795
|
end
|
|
769
796
|
end
|
|
@@ -810,14 +837,14 @@ describe Paperclip::Storage::S3 do
|
|
|
810
837
|
it "generates a url for the thumb" do
|
|
811
838
|
object = double
|
|
812
839
|
allow(@dummy.avatar).to receive(:s3_object).with(:thumb).and_return(object)
|
|
813
|
-
expect(object).to receive(:presigned_url).with(:get, expires_in: 1800)
|
|
840
|
+
expect(object).to receive(:presigned_url).with(:get, { expires_in: 1800 })
|
|
814
841
|
@dummy.avatar.expiring_url(1800, :thumb)
|
|
815
842
|
end
|
|
816
843
|
|
|
817
844
|
it "generates a url for the default style" do
|
|
818
845
|
object = double
|
|
819
846
|
allow(@dummy.avatar).to receive(:s3_object).with(:original).and_return(object)
|
|
820
|
-
expect(object).to receive(:presigned_url).with(:get, expires_in: 1800)
|
|
847
|
+
expect(object).to receive(:presigned_url).with(:get, { expires_in: 1800 })
|
|
821
848
|
@dummy.avatar.expiring_url(1800)
|
|
822
849
|
end
|
|
823
850
|
end
|
|
@@ -962,7 +989,7 @@ describe Paperclip::Storage::S3 do
|
|
|
962
989
|
object = double
|
|
963
990
|
allow(@dummy.avatar).to receive(:s3_object).and_return(object)
|
|
964
991
|
expect(object).to receive(:upload_file).
|
|
965
|
-
with(anything, content_type: "image/png", acl: :"public-read")
|
|
992
|
+
with(anything, { content_type: "image/png", acl: :"public-read" })
|
|
966
993
|
@dummy.save
|
|
967
994
|
end
|
|
968
995
|
|
|
@@ -1122,10 +1149,14 @@ describe Paperclip::Storage::S3 do
|
|
|
1122
1149
|
allow(@dummy.avatar).to receive(:s3_object).and_return(object)
|
|
1123
1150
|
|
|
1124
1151
|
expect(object).to receive(:upload_file).
|
|
1125
|
-
with(
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1152
|
+
with(
|
|
1153
|
+
anything,
|
|
1154
|
+
{
|
|
1155
|
+
content_type: "image/png",
|
|
1156
|
+
acl: :"public-read",
|
|
1157
|
+
cache_control: "max-age=31557600",
|
|
1158
|
+
},
|
|
1159
|
+
)
|
|
1129
1160
|
@dummy.save
|
|
1130
1161
|
end
|
|
1131
1162
|
|
|
@@ -1163,10 +1194,14 @@ describe Paperclip::Storage::S3 do
|
|
|
1163
1194
|
allow(@dummy.avatar).to receive(:s3_object).and_return(object)
|
|
1164
1195
|
|
|
1165
1196
|
expect(object).to receive(:upload_file).
|
|
1166
|
-
with(
|
|
1197
|
+
with(
|
|
1198
|
+
anything,
|
|
1199
|
+
{
|
|
1167
1200
|
content_type: "image/png",
|
|
1168
1201
|
acl: :"public-read",
|
|
1169
|
-
metadata: { "color" => "red" }
|
|
1202
|
+
metadata: { "color" => "red" },
|
|
1203
|
+
},
|
|
1204
|
+
)
|
|
1170
1205
|
@dummy.save
|
|
1171
1206
|
end
|
|
1172
1207
|
|
|
@@ -1204,10 +1239,14 @@ describe Paperclip::Storage::S3 do
|
|
|
1204
1239
|
allow(@dummy.avatar).to receive(:s3_object).and_return(object)
|
|
1205
1240
|
|
|
1206
1241
|
expect(object).to receive(:upload_file).
|
|
1207
|
-
with(
|
|
1242
|
+
with(
|
|
1243
|
+
anything,
|
|
1244
|
+
{
|
|
1208
1245
|
content_type: "image/png",
|
|
1209
1246
|
acl: :"public-read",
|
|
1210
|
-
metadata: { "color" => "red" }
|
|
1247
|
+
metadata: { "color" => "red" },
|
|
1248
|
+
},
|
|
1249
|
+
)
|
|
1211
1250
|
@dummy.save
|
|
1212
1251
|
end
|
|
1213
1252
|
|
|
@@ -1246,10 +1285,14 @@ describe Paperclip::Storage::S3 do
|
|
|
1246
1285
|
allow(@dummy.avatar).to receive(:s3_object).and_return(object)
|
|
1247
1286
|
|
|
1248
1287
|
expect(object).to receive(:upload_file).
|
|
1249
|
-
with(
|
|
1288
|
+
with(
|
|
1289
|
+
anything,
|
|
1290
|
+
{
|
|
1250
1291
|
content_type: "image/png",
|
|
1251
1292
|
acl: :"public-read",
|
|
1252
|
-
storage_class: "reduced_redundancy"
|
|
1293
|
+
storage_class: "reduced_redundancy",
|
|
1294
|
+
},
|
|
1295
|
+
)
|
|
1253
1296
|
@dummy.save
|
|
1254
1297
|
end
|
|
1255
1298
|
|
|
@@ -1342,9 +1385,14 @@ describe Paperclip::Storage::S3 do
|
|
|
1342
1385
|
allow(@dummy.avatar).to receive(:s3_object).with(style).and_return(object)
|
|
1343
1386
|
|
|
1344
1387
|
expect(object).to receive(:upload_file).
|
|
1345
|
-
with(
|
|
1346
|
-
|
|
1347
|
-
|
|
1388
|
+
with(
|
|
1389
|
+
anything,
|
|
1390
|
+
{
|
|
1391
|
+
content_type: "image/png",
|
|
1392
|
+
acl: :"public-read",
|
|
1393
|
+
storage_class: :reduced_redundancy,
|
|
1394
|
+
},
|
|
1395
|
+
)
|
|
1348
1396
|
end
|
|
1349
1397
|
@dummy.save
|
|
1350
1398
|
end
|
|
@@ -1387,7 +1435,7 @@ describe Paperclip::Storage::S3 do
|
|
|
1387
1435
|
allow(@dummy.avatar).to receive(:s3_object).and_return(object)
|
|
1388
1436
|
|
|
1389
1437
|
expect(object).to receive(:upload_file).
|
|
1390
|
-
with(anything, content_type: "image/png", acl: :"public-read")
|
|
1438
|
+
with(anything, { content_type: "image/png", acl: :"public-read" })
|
|
1391
1439
|
@dummy.save
|
|
1392
1440
|
end
|
|
1393
1441
|
|
|
@@ -1426,9 +1474,14 @@ describe Paperclip::Storage::S3 do
|
|
|
1426
1474
|
allow(@dummy.avatar).to receive(:s3_object).and_return(object)
|
|
1427
1475
|
|
|
1428
1476
|
expect(object).to receive(:upload_file).
|
|
1429
|
-
with(
|
|
1430
|
-
|
|
1431
|
-
|
|
1477
|
+
with(
|
|
1478
|
+
anything,
|
|
1479
|
+
{
|
|
1480
|
+
content_type: "image/png",
|
|
1481
|
+
acl: :"public-read",
|
|
1482
|
+
server_side_encryption: "AES256",
|
|
1483
|
+
},
|
|
1484
|
+
)
|
|
1432
1485
|
@dummy.save
|
|
1433
1486
|
end
|
|
1434
1487
|
|
|
@@ -1466,10 +1519,14 @@ describe Paperclip::Storage::S3 do
|
|
|
1466
1519
|
allow(@dummy.avatar).to receive(:s3_object).and_return(object)
|
|
1467
1520
|
|
|
1468
1521
|
expect(object).to receive(:upload_file).
|
|
1469
|
-
with(
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1522
|
+
with(
|
|
1523
|
+
anything,
|
|
1524
|
+
{
|
|
1525
|
+
content_type: "image/png",
|
|
1526
|
+
acl: :"public-read",
|
|
1527
|
+
storage_class: :reduced_redundancy,
|
|
1528
|
+
},
|
|
1529
|
+
)
|
|
1473
1530
|
@dummy.save
|
|
1474
1531
|
end
|
|
1475
1532
|
|
|
@@ -1613,7 +1670,7 @@ describe Paperclip::Storage::S3 do
|
|
|
1613
1670
|
allow(@dummy.avatar).to receive(:s3_object).and_return(object)
|
|
1614
1671
|
|
|
1615
1672
|
expect(object).to receive(:upload_file).
|
|
1616
|
-
with(anything, content_type: "image/png", acl: :"public-read")
|
|
1673
|
+
with(anything, { content_type: "image/png", acl: :"public-read" })
|
|
1617
1674
|
@dummy.save
|
|
1618
1675
|
end
|
|
1619
1676
|
|
|
@@ -1651,7 +1708,7 @@ describe Paperclip::Storage::S3 do
|
|
|
1651
1708
|
allow(@dummy.avatar).to receive(:s3_object).and_return(object)
|
|
1652
1709
|
|
|
1653
1710
|
expect(object).to receive(:upload_file).
|
|
1654
|
-
with(anything, content_type: "image/png", acl: :private)
|
|
1711
|
+
with(anything, { content_type: "image/png", acl: :private })
|
|
1655
1712
|
@dummy.save
|
|
1656
1713
|
end
|
|
1657
1714
|
|
|
@@ -1697,8 +1754,10 @@ describe Paperclip::Storage::S3 do
|
|
|
1697
1754
|
|
|
1698
1755
|
expect(object).to receive(:upload_file).
|
|
1699
1756
|
with(anything,
|
|
1700
|
-
|
|
1701
|
-
|
|
1757
|
+
{
|
|
1758
|
+
content_type: "image/png",
|
|
1759
|
+
acl: style == :thumb ? :public_read : :private
|
|
1760
|
+
})
|
|
1702
1761
|
end
|
|
1703
1762
|
@dummy.save
|
|
1704
1763
|
end
|
|
@@ -1767,10 +1826,14 @@ describe Paperclip::Storage::S3 do
|
|
|
1767
1826
|
allow(@dummy.avatar).to receive(:s3_object).with(style).and_return(object)
|
|
1768
1827
|
|
|
1769
1828
|
expect(object).to receive(:upload_file).
|
|
1770
|
-
with(
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1829
|
+
with(
|
|
1830
|
+
anything,
|
|
1831
|
+
{
|
|
1832
|
+
content_type: "image/png",
|
|
1833
|
+
acl: :"public-read",
|
|
1834
|
+
content_disposition: 'attachment; filename="Custom Avatar Name.png"',
|
|
1835
|
+
},
|
|
1836
|
+
)
|
|
1774
1837
|
end
|
|
1775
1838
|
@dummy.save
|
|
1776
1839
|
end
|
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: 7.2.
|
|
4
|
+
version: 7.2.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Surendra Singhi
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2023-
|
|
11
|
+
date: 2023-09-09 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activemodel
|
|
@@ -428,6 +428,7 @@ files:
|
|
|
428
428
|
- lib/paperclip/io_adapters/uploaded_file_adapter.rb
|
|
429
429
|
- lib/paperclip/io_adapters/uri_adapter.rb
|
|
430
430
|
- lib/paperclip/locales/en.yml
|
|
431
|
+
- lib/paperclip/locales/gd.yml
|
|
431
432
|
- lib/paperclip/logger.rb
|
|
432
433
|
- lib/paperclip/matchers.rb
|
|
433
434
|
- lib/paperclip/matchers/have_attached_file_matcher.rb
|