kt-paperclip 7.0.1 → 7.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.hound.yml +3 -1057
- data/.rubocop.yml +1059 -1
- data/Gemfile +2 -1
- data/gemfiles/7.0.gemfile +21 -0
- data/lib/paperclip/content_type_detector.rb +7 -3
- data/lib/paperclip/validators/attachment_size_validator.rb +3 -2
- data/lib/paperclip/version.rb +1 -1
- data/spec/paperclip/content_type_detector_spec.rb +7 -0
- data/spec/support/fixtures/sample.xlsm +0 -0
- metadata +4 -2
data/Gemfile
CHANGED
@@ -12,7 +12,8 @@ group :development, :test do
|
|
12
12
|
gem "builder"
|
13
13
|
gem "listen", "~> 3.0.8"
|
14
14
|
gem "rspec"
|
15
|
-
|
15
|
+
# Hound only supports certain versions of Rubocop -- 1.22.1 is currently the most recent one supported.
|
16
|
+
gem "rubocop", "1.22.1", require: false
|
16
17
|
gem "rubocop-rails"
|
17
18
|
gem "sprockets", "3.7.2"
|
18
19
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# This file was generated by Appraisal
|
2
|
+
|
3
|
+
source "https://rubygems.org"
|
4
|
+
|
5
|
+
gem "pry"
|
6
|
+
gem "sqlite3", "~> 1.4", platforms: :ruby
|
7
|
+
gem "aruba", "~> 1.0", ">= 1.0.4"
|
8
|
+
gem "rails", "~> 7.0.0"
|
9
|
+
|
10
|
+
group :development, :test do
|
11
|
+
gem "activerecord-import"
|
12
|
+
gem "bootsnap", require: false
|
13
|
+
gem "builder"
|
14
|
+
gem "listen", "~> 3.0.8"
|
15
|
+
gem "rspec"
|
16
|
+
gem "rubocop", require: false
|
17
|
+
gem "rubocop-rails"
|
18
|
+
gem "sprockets", "3.7.2"
|
19
|
+
end
|
20
|
+
|
21
|
+
gemspec path: "../"
|
@@ -67,9 +67,13 @@ module Paperclip
|
|
67
67
|
end
|
68
68
|
|
69
69
|
def type_from_marcel
|
70
|
-
@type_from_marcel
|
71
|
-
|
72
|
-
|
70
|
+
return @type_from_marcel if defined? @type_from_marcel
|
71
|
+
|
72
|
+
@type_from_marcel = Marcel::MimeType.for Pathname.new(@filepath),
|
73
|
+
name: @filepath
|
74
|
+
# Marcel::MineType returns 'application/octet-stream' if it can't find
|
75
|
+
# a valid type.
|
76
|
+
@type_from_marcel = nil if @type_from_marcel == SENSIBLE_DEFAULT
|
73
77
|
end
|
74
78
|
|
75
79
|
def type_from_file_command
|
@@ -35,8 +35,9 @@ 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
|
-
|
39
|
-
|
38
|
+
operator = Rails::VERSION::MAJOR >= 7 ? COMPARE_CHECKS[option] : CHECKS[option]
|
39
|
+
|
40
|
+
unless value.send(operator, option_value)
|
40
41
|
error_message_key = options[:in] ? :in_between : option
|
41
42
|
error_attrs.each do |error_attr_name|
|
42
43
|
record.errors.add(error_attr_name, error_message_key, **filtered_options(value).merge(
|
data/lib/paperclip/version.rb
CHANGED
@@ -7,6 +7,13 @@ describe Paperclip::ContentTypeDetector do
|
|
7
7
|
Paperclip::ContentTypeDetector.new(file.path).detect
|
8
8
|
end
|
9
9
|
|
10
|
+
it 'returns a more specific content type based on the filename if it matches
|
11
|
+
multiple content types' do
|
12
|
+
file = File.new(fixture_file('sample.xlsm'))
|
13
|
+
assert_equal 'application/vnd.ms-excel.sheet.macroenabled.12',
|
14
|
+
Paperclip::ContentTypeDetector.new(file.path).detect
|
15
|
+
end
|
16
|
+
|
10
17
|
it "gives a sensible default when the name is empty" do
|
11
18
|
assert_equal "application/octet-stream", Paperclip::ContentTypeDetector.new("").detect
|
12
19
|
end
|
Binary file
|
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.0
|
4
|
+
version: 7.1.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:
|
11
|
+
date: 2022-02-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|
@@ -394,6 +394,7 @@ files:
|
|
394
394
|
- gemfiles/5.2.gemfile
|
395
395
|
- gemfiles/6.0.gemfile
|
396
396
|
- gemfiles/6.1.gemfile
|
397
|
+
- gemfiles/7.0.gemfile
|
397
398
|
- lib/generators/paperclip/USAGE
|
398
399
|
- lib/generators/paperclip/paperclip_generator.rb
|
399
400
|
- lib/generators/paperclip/templates/paperclip_migration.rb.erb
|
@@ -533,6 +534,7 @@ files:
|
|
533
534
|
- spec/support/fixtures/fog.yml
|
534
535
|
- spec/support/fixtures/rotated.jpg
|
535
536
|
- spec/support/fixtures/s3.yml
|
537
|
+
- spec/support/fixtures/sample.xlsm
|
536
538
|
- spec/support/fixtures/spaced file.jpg
|
537
539
|
- spec/support/fixtures/spaced file.png
|
538
540
|
- spec/support/fixtures/text.txt
|