paperclip 4.2.1 → 4.3.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/.hound.yml +1066 -0
- data/.rubocop.yml +1 -0
- data/.travis.yml +5 -3
- data/Appraisals +2 -7
- data/CONTRIBUTING.md +3 -3
- data/Gemfile +2 -1
- data/LICENSE +1 -1
- data/NEWS +57 -30
- data/README.md +137 -77
- data/RELEASING.md +17 -0
- data/Rakefile +1 -1
- data/features/basic_integration.feature +7 -4
- data/features/step_definitions/attachment_steps.rb +7 -1
- data/gemfiles/3.2.gemfile +2 -1
- data/gemfiles/4.1.gemfile +2 -1
- data/gemfiles/4.2.gemfile +3 -2
- data/lib/paperclip/attachment.rb +3 -1
- data/lib/paperclip/attachment_registry.rb +1 -1
- data/lib/paperclip/content_type_detector.rb +26 -11
- data/lib/paperclip/file_command_content_type_detector.rb +6 -8
- data/lib/paperclip/glue.rb +1 -1
- data/lib/paperclip/has_attached_file.rb +2 -1
- data/lib/paperclip/interpolations.rb +1 -1
- data/lib/paperclip/io_adapters/abstract_adapter.rb +1 -0
- data/lib/paperclip/locales/en.yml +1 -1
- data/lib/paperclip/media_type_spoof_detector.rb +38 -18
- data/lib/paperclip/rails_environment.rb +25 -0
- data/lib/paperclip/storage/fog.rb +4 -4
- data/lib/paperclip/storage/s3.rb +2 -3
- data/lib/paperclip/thumbnail.rb +2 -3
- data/lib/paperclip/validators/media_type_spoof_detection_validator.rb +1 -1
- data/lib/paperclip/version.rb +1 -1
- data/lib/paperclip.rb +13 -3
- data/lib/tasks/paperclip.rake +16 -0
- data/paperclip.gemspec +9 -10
- data/spec/paperclip/attachment_definitions_spec.rb +1 -1
- data/spec/paperclip/attachment_registry_spec.rb +56 -13
- data/spec/paperclip/attachment_spec.rb +57 -19
- data/spec/paperclip/content_type_detector_spec.rb +8 -1
- data/spec/paperclip/file_command_content_type_detector_spec.rb +0 -1
- data/spec/paperclip/interpolations_spec.rb +2 -9
- data/spec/paperclip/io_adapters/abstract_adapter_spec.rb +2 -1
- data/spec/paperclip/io_adapters/file_adapter_spec.rb +4 -1
- data/spec/paperclip/io_adapters/stringio_adapter_spec.rb +4 -0
- data/spec/paperclip/media_type_spoof_detector_spec.rb +31 -7
- data/spec/paperclip/paperclip_spec.rb +1 -1
- data/spec/paperclip/rails_environment_spec.rb +33 -0
- data/spec/paperclip/storage/fog_spec.rb +11 -2
- data/spec/paperclip/storage/s3_spec.rb +43 -25
- data/spec/paperclip/tempfile_factory_spec.rb +4 -0
- data/spec/paperclip/thumbnail_spec.rb +16 -0
- data/spec/paperclip/url_generator_spec.rb +1 -1
- data/spec/paperclip/validators/media_type_spoof_detection_validator_spec.rb +1 -1
- data/spec/support/fake_model.rb +4 -0
- data/spec/support/fixtures/empty.xlsx +0 -0
- data/spec/support/matchers/have_column.rb +11 -2
- metadata +49 -24
- data/RUNNING_TESTS.md +0 -4
- data/gemfiles/4.0.gemfile +0 -19
- data/spec/support/mock_model.rb +0 -2
data/.rubocop.yml
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
inherit_from: .hound.yml
|
data/.travis.yml
CHANGED
|
@@ -1,23 +1,25 @@
|
|
|
1
1
|
rvm:
|
|
2
|
-
- 1.9.3
|
|
3
2
|
- jruby-19mode
|
|
4
3
|
- rbx-2
|
|
5
4
|
- 2.0.0
|
|
6
5
|
- 2.1.1
|
|
6
|
+
- 2.2.2
|
|
7
7
|
|
|
8
8
|
install:
|
|
9
9
|
- "travis_retry bundle install"
|
|
10
10
|
|
|
11
|
-
before_script: "sudo ntpdate -ub ntp.ubuntu.com pool.ntp.org; true"
|
|
12
11
|
script: "bundle exec rake clean spec cucumber"
|
|
13
12
|
|
|
14
13
|
gemfile:
|
|
15
14
|
- gemfiles/3.2.gemfile
|
|
16
|
-
- gemfiles/4.0.gemfile
|
|
17
15
|
- gemfiles/4.1.gemfile
|
|
16
|
+
- gemfiles/4.2.gemfile
|
|
18
17
|
|
|
19
18
|
matrix:
|
|
20
19
|
fast_finish: true
|
|
21
20
|
allow_failures:
|
|
22
21
|
- rvm: jruby-19mode
|
|
23
22
|
- rvm: rbx-2
|
|
23
|
+
|
|
24
|
+
sudo: false
|
|
25
|
+
cache: bundler
|
data/Appraisals
CHANGED
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
appraise "3.2" do
|
|
2
|
-
gem "rails", "~> 3.2.
|
|
3
|
-
gem "paperclip", :path => "../"
|
|
4
|
-
end
|
|
5
|
-
|
|
6
|
-
appraise "4.0" do
|
|
7
|
-
gem "rails", "~> 4.0.0"
|
|
2
|
+
gem "rails", "~> 3.2.0"
|
|
8
3
|
gem "paperclip", :path => "../"
|
|
9
4
|
end
|
|
10
5
|
|
|
@@ -14,6 +9,6 @@ appraise "4.1" do
|
|
|
14
9
|
end
|
|
15
10
|
|
|
16
11
|
appraise "4.2" do
|
|
17
|
-
gem "rails", "~> 4.2.0
|
|
12
|
+
gem "rails", "~> 4.2.0"
|
|
18
13
|
gem "paperclip", :path => "../"
|
|
19
14
|
end
|
data/CONTRIBUTING.md
CHANGED
|
@@ -6,7 +6,7 @@ We love pull requests. Here's a quick guide:
|
|
|
6
6
|
1. Fork the repo.
|
|
7
7
|
|
|
8
8
|
2. Run the tests. We only take pull requests with passing tests, and it's great
|
|
9
|
-
to know that you have a clean slate: `bundle && rake`
|
|
9
|
+
to know that you have a clean slate: `bundle && bundle exec rake`
|
|
10
10
|
|
|
11
11
|
3. Add a test for your change. Only refactoring and documentation changes
|
|
12
12
|
require no new tests. If you are adding functionality or fixing a bug, we need
|
|
@@ -43,14 +43,14 @@ will be asked to rewrite them before we'll accept.
|
|
|
43
43
|
### Bootstrapping your test suite:
|
|
44
44
|
|
|
45
45
|
bundle install
|
|
46
|
-
bundle exec
|
|
46
|
+
bundle exec appraisal install
|
|
47
47
|
|
|
48
48
|
This will install all the required gems that requires to test against each
|
|
49
49
|
version of Rails, which defined in `gemfiles/*.gemfile`.
|
|
50
50
|
|
|
51
51
|
### To run a full test suite:
|
|
52
52
|
|
|
53
|
-
bundle exec rake
|
|
53
|
+
bundle exec appraisal rake
|
|
54
54
|
|
|
55
55
|
This will run RSpec and Cucumber against all version of Rails
|
|
56
56
|
|
data/Gemfile
CHANGED
|
@@ -2,7 +2,7 @@ source "https://rubygems.org"
|
|
|
2
2
|
|
|
3
3
|
gemspec
|
|
4
4
|
|
|
5
|
-
gem 'sqlite3', '1.3.8', :platforms => :ruby
|
|
5
|
+
gem 'sqlite3', '~> 1.3.8', :platforms => :ruby
|
|
6
6
|
|
|
7
7
|
gem 'jruby-openssl', :platforms => :jruby
|
|
8
8
|
gem 'activerecord-jdbcsqlite3-adapter', :platforms => :jruby
|
|
@@ -17,4 +17,5 @@ gem 'pry'
|
|
|
17
17
|
group :development, :test do
|
|
18
18
|
gem 'mime-types', '~> 1.16'
|
|
19
19
|
gem 'builder'
|
|
20
|
+
gem 'rubocop', require: false
|
|
20
21
|
end
|
data/LICENSE
CHANGED
|
@@ -3,7 +3,7 @@ LICENSE
|
|
|
3
3
|
|
|
4
4
|
The MIT License
|
|
5
5
|
|
|
6
|
-
Copyright (c) 2008-
|
|
6
|
+
Copyright (c) 2008-2015 Jon Yurek and thoughtbot, inc.
|
|
7
7
|
|
|
8
8
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
9
9
|
of this software and associated documentation files (the "Software"), to deal
|
data/NEWS
CHANGED
|
@@ -1,4 +1,31 @@
|
|
|
1
|
-
|
|
1
|
+
4.3.0:
|
|
2
|
+
|
|
3
|
+
* Improvement: Update aws-sdk and cucumber gem versions.
|
|
4
|
+
* Improvement: Add `length` alias for `size` method in AbstractAdapter.
|
|
5
|
+
* Improvement: Removed some cruft
|
|
6
|
+
* Improvement: deep_merge! Attachment definitions
|
|
7
|
+
* Improvement: Switch to mimemagic gem for content-type detection
|
|
8
|
+
* Improvement: Allows multiple content types for spoof detector
|
|
9
|
+
* Bug Fix: Don't assume we have Rails.env if we have Rails
|
|
10
|
+
* Performance: Decrease Memory footprint
|
|
11
|
+
* Ruby Versioning: Drop support for 1.9.3 (EOL'ed)
|
|
12
|
+
* Rails Versioning: Drop support for 4.0.0 (EOL'ed)
|
|
13
|
+
|
|
14
|
+
4.2.4:
|
|
15
|
+
|
|
16
|
+
* Rollback backwards incompatible change, allowing paperclip to run on
|
|
17
|
+
Ruby >= 1.9.2.
|
|
18
|
+
|
|
19
|
+
4.2.3:
|
|
20
|
+
|
|
21
|
+
* Fix dependency specifications (didn't work with Rails 4.1)
|
|
22
|
+
* Fix paperclip tests in CI
|
|
23
|
+
|
|
24
|
+
4.2.2:
|
|
25
|
+
|
|
26
|
+
* Security fix: Fix a potential security issue with spoofing
|
|
27
|
+
|
|
28
|
+
4.2.1:
|
|
2
29
|
|
|
3
30
|
* Improvement: Added `validate_media_type` options to allow/bypass spoof check
|
|
4
31
|
* Improvement: Added incremental backoff when AWS gives us a SlowDown error.
|
|
@@ -8,14 +35,14 @@ New in 4.2.1:
|
|
|
8
35
|
* Improvement: Better escaping for characters in URLs
|
|
9
36
|
* Improvement: Honor `fog_credentials[:scheme]`
|
|
10
37
|
* Improvement: Also look for custom processors in lib/paperclip
|
|
11
|
-
* Improvement: id partitioning for string IDs works
|
|
38
|
+
* Improvement: id partitioning for string IDs works like integer id
|
|
12
39
|
* Improvement: Can pass options to DB adapters in migrations
|
|
13
40
|
* Improvement: Update expiring_url creation for later versions of fog
|
|
14
41
|
* Improvement: `path` can be a Proc in S3 attachments
|
|
15
42
|
* Test Fix: Improves speed and reliability of the specs
|
|
16
43
|
* Bug Fix: #original_filename= does not error when passed `nil`
|
|
17
44
|
|
|
18
|
-
|
|
45
|
+
4.2.0:
|
|
19
46
|
|
|
20
47
|
* Improvement: Converted test suite from test/unit to RSpec
|
|
21
48
|
* Improvement: Refactored Paperclip::Attachment#assign
|
|
@@ -31,7 +58,7 @@ New in 4.2.0:
|
|
|
31
58
|
* Improvement: Allow `nil` geometry strings
|
|
32
59
|
* Improvement: Use `eager_load!`
|
|
33
60
|
|
|
34
|
-
|
|
61
|
+
4.1.1:
|
|
35
62
|
|
|
36
63
|
* Improvement: Add default translations for spoof validation
|
|
37
64
|
* Bug Fix: Don't check for spoofs if the file hasn't changed
|
|
@@ -42,7 +69,7 @@ New in 4.1.1:
|
|
|
42
69
|
* Improvement: Allow travis-ci to finish-fast
|
|
43
70
|
|
|
44
71
|
|
|
45
|
-
|
|
72
|
+
4.1.0:
|
|
46
73
|
|
|
47
74
|
* Improvement: Add :content_type_mappings to correct for missing spoof types
|
|
48
75
|
* Improvement: Credit Egor Homakov with discovering the content_type spoof bug
|
|
@@ -50,7 +77,7 @@ New in 4.1.0:
|
|
|
50
77
|
* Improvement: Make MIME type optional for Data URIs.
|
|
51
78
|
* Improvement: Add default format for styles
|
|
52
79
|
|
|
53
|
-
|
|
80
|
+
4.0.0:
|
|
54
81
|
|
|
55
82
|
* Security: Attachments are checked to make sure they're not pulling a fast one.
|
|
56
83
|
* Security: It is now *enforced* that every attachment has a file/mime validation.
|
|
@@ -58,7 +85,7 @@ New in 4.0.0:
|
|
|
58
85
|
* Improvement: Added bullets to the 3.5.3 list of changes. Very important.
|
|
59
86
|
* Improvement: Updated the copyright to 2014
|
|
60
87
|
|
|
61
|
-
|
|
88
|
+
3.5.3:
|
|
62
89
|
|
|
63
90
|
* Improvement: After three long, hard years... we know how to upgrade
|
|
64
91
|
* Bug Fix: #expiring_url returns 'missing' urls if nothing is attached
|
|
@@ -80,14 +107,14 @@ New in 3.5.3:
|
|
|
80
107
|
* Test Improvement: Ensure more files are properly closed during tests
|
|
81
108
|
* Test Bug Fix: Return the gemfile's syntax to normal
|
|
82
109
|
|
|
83
|
-
|
|
110
|
+
3.5.2:
|
|
84
111
|
|
|
85
112
|
* Security: Force cocaine to at least 0.5.3 to include a security fix
|
|
86
113
|
* Improvement: Fixed some README exmaples
|
|
87
114
|
* Feature: Added HTTP URL Proxy Adapter, can assign string URLs as attachments
|
|
88
115
|
* Improvement: Put validation errors on the base attribute and the sub-attribute
|
|
89
116
|
|
|
90
|
-
|
|
117
|
+
3.5.1:
|
|
91
118
|
|
|
92
119
|
* Bug Fix: Returned the class-level `attachment_definitions` method for compatability.
|
|
93
120
|
* Improvement: Ensured compatability with Rails 4
|
|
@@ -95,7 +122,7 @@ New in 3.5.1:
|
|
|
95
122
|
* Bug Fix: #1296, where validations were generating errors
|
|
96
123
|
* Improvement: Specify MIT license in the gemspec
|
|
97
124
|
|
|
98
|
-
|
|
125
|
+
3.5.0:
|
|
99
126
|
|
|
100
127
|
* Feature: Handle Base64-encoded data URIs as uploads
|
|
101
128
|
* Feature: Add a FilenameCleaner class to allow custom filename sanitation
|
|
@@ -111,7 +138,7 @@ New in 3.5.0:
|
|
|
111
138
|
* Improvement: Added Ruby 2.0.0 as a supported platform and removed 1.8.7
|
|
112
139
|
* Improvement: Fixed some incompatabilities in the test suite
|
|
113
140
|
|
|
114
|
-
|
|
141
|
+
3.4.2:
|
|
115
142
|
|
|
116
143
|
* Improvement: Use https for Gemfile urls
|
|
117
144
|
* Improvement: Updated and more correct documentation
|
|
@@ -121,7 +148,7 @@ New in 3.4.2:
|
|
|
121
148
|
* Improvement: Remove path clash checking, as it's unnecessary
|
|
122
149
|
* Bug Fix: Do not rely on checking version numbers for aws-sdk
|
|
123
150
|
|
|
124
|
-
|
|
151
|
+
3.4.1:
|
|
125
152
|
|
|
126
153
|
* Improvement: Various documentation fixes and improvements
|
|
127
154
|
* Bug Fix: Clearing an attachment with `preserve_files` on should still clear the attachment
|
|
@@ -134,7 +161,7 @@ New in 3.4.1:
|
|
|
134
161
|
* Improvement: Update to latest cocaine
|
|
135
162
|
* Improvement: Update copyrights, various typos
|
|
136
163
|
|
|
137
|
-
|
|
164
|
+
3.4.0:
|
|
138
165
|
|
|
139
166
|
* Bug Fix: Allow UploadedFileAdapter to force the use of `file`
|
|
140
167
|
* Bug Fix: Close the file handle when dealing with URIs
|
|
@@ -164,11 +191,11 @@ New In 3.3.1:
|
|
|
164
191
|
|
|
165
192
|
* Bug Fix: Moved Filesystem's copy_to_local_file to the right place.
|
|
166
193
|
|
|
167
|
-
|
|
194
|
+
3.3.0:
|
|
168
195
|
|
|
169
196
|
* Improvement: Upgrade cocaine to 0.4
|
|
170
197
|
|
|
171
|
-
|
|
198
|
+
3.2.0:
|
|
172
199
|
|
|
173
200
|
* Bug Fix: Use the new correct Amazon S3 encryption header.
|
|
174
201
|
* Bug Fix: The rake task respects the updated_at column.
|
|
@@ -177,14 +204,14 @@ New in 3.2.0:
|
|
|
177
204
|
* Feature: Automatically rotate images.
|
|
178
205
|
* Feature: Reduce class-oriented programming of the attachment definitions.
|
|
179
206
|
|
|
180
|
-
|
|
207
|
+
3.1.4:
|
|
181
208
|
|
|
182
209
|
* Bug Fix: Allow user to be able to set path without `:style` attribute and not raising an error.
|
|
183
210
|
This is a regression introduced in 3.1.3, and that feature will be postponed to another minor
|
|
184
211
|
release instead.
|
|
185
212
|
* Feature: Allow for URI Adapter as an optional paperclip io adapter.
|
|
186
213
|
|
|
187
|
-
|
|
214
|
+
3.1.3:
|
|
188
215
|
|
|
189
216
|
* Bug Fix: Copy empty attachment between instances is now working.
|
|
190
217
|
* Bug Fix: Correctly rescue Fog error.
|
|
@@ -196,17 +223,17 @@ New in 3.1.3:
|
|
|
196
223
|
* Bug Fix: Paperclip now gracefully handles msising file command.
|
|
197
224
|
* Bug Fix: `StringIOAdapter` now accepts content type.
|
|
198
225
|
|
|
199
|
-
|
|
226
|
+
3.1.2:
|
|
200
227
|
|
|
201
228
|
* Bug Fix: #remove_attachment on 3.1.0 and 3.1.1 mistakenly trying to remove the column that has
|
|
202
229
|
the same name as data type (such as :string, :datetime, :interger.) You're advised to update to
|
|
203
230
|
Paperclip 3.1.2 as soon as possible.
|
|
204
231
|
|
|
205
|
-
|
|
232
|
+
3.1.1:
|
|
206
233
|
|
|
207
234
|
* Bug Fix: Paperclip will only load Paperclip::Schema only when Active Record is available.
|
|
208
235
|
|
|
209
|
-
|
|
236
|
+
3.1.0:
|
|
210
237
|
|
|
211
238
|
* Feature: Paperclip now support new migration syntax (sexy migration) that reads better:
|
|
212
239
|
|
|
@@ -245,11 +272,11 @@ New in 3.1.0:
|
|
|
245
272
|
the best_content_type to throw an error on trying nil.content_type.
|
|
246
273
|
* Bug Fix: Fix problem when the gem cannot be installed on the system that has Asepsis installed.
|
|
247
274
|
|
|
248
|
-
|
|
275
|
+
3.0.4:
|
|
249
276
|
|
|
250
277
|
* Feature: Adds support for S3 scheme-less URL generation.
|
|
251
278
|
|
|
252
|
-
|
|
279
|
+
3.0.3:
|
|
253
280
|
|
|
254
281
|
* Bug Fix: ThumbnailProcessor now correctly detects and preserve animated GIF.
|
|
255
282
|
* Bug Fix: File extension is now preserved in generated Tempfile from adapter.
|
|
@@ -272,7 +299,7 @@ New in 3.0.3:
|
|
|
272
299
|
* Bug Fix: Fix attachment.reprocess! when using storage providers fog and s3.
|
|
273
300
|
* Bug Fix: Fix a problem with incorrect content_type detected with 'file' command for an empty file on Mac.
|
|
274
301
|
|
|
275
|
-
|
|
302
|
+
3.0.2:
|
|
276
303
|
|
|
277
304
|
* API CHANGE: Generated migration class name is now plural (AddAttachmentToUsers instead of AddAttachmentToUser)
|
|
278
305
|
* API CHANGE: Remove Rails plugin initialization code.
|
|
@@ -281,13 +308,13 @@ New in 3.0.2:
|
|
|
281
308
|
* Bug Fix: Fix a problem when there's no logger specified.
|
|
282
309
|
* Bug Fix: Fix a problem when attaching Rack::Test::UploadedFile instance.
|
|
283
310
|
|
|
284
|
-
|
|
311
|
+
3.0.1:
|
|
285
312
|
|
|
286
313
|
* Feature: Introduce Paperlip IO adapter.
|
|
287
314
|
* Bug Fix: Regression in AttachmentContentTypeValidator has been fixed.
|
|
288
315
|
* API CHANGE: #to_file has been removed. Use the #copy_to_local_file method instead.
|
|
289
316
|
|
|
290
|
-
|
|
317
|
+
3.0.0:
|
|
291
318
|
|
|
292
319
|
* API CHANGE: Paperclip now requires at least Ruby on Rails version 3.0.0
|
|
293
320
|
* API CHANGE: The default :url and :path have changed. The new scheme avoids
|
|
@@ -306,7 +333,7 @@ New in 3.0.0:
|
|
|
306
333
|
* Bug Fix: File given to S3 and Fog storage will now be rewinded after flush_write.
|
|
307
334
|
* Feature: You can now pass addional parameter to S3 expiring URL, such as :content_type.
|
|
308
335
|
|
|
309
|
-
|
|
336
|
+
2.7.0:
|
|
310
337
|
|
|
311
338
|
* Bug Fix: Checking the existence of a file on S3 handles all AWS errors.
|
|
312
339
|
* Bug Fix: Clear the fingerprint when removing an attachment.
|
|
@@ -315,25 +342,25 @@ New in 2.7.0:
|
|
|
315
342
|
* Compatibility: Support for ActiveSupport < 2.3.12.
|
|
316
343
|
* Compatibility: Support for Rails 3.2.
|
|
317
344
|
|
|
318
|
-
|
|
345
|
+
2.6.0:
|
|
319
346
|
|
|
320
347
|
* Bug Fix: Files are re-wound after reading.
|
|
321
348
|
* Feature: Remove Rails dependency from specs that need Paperclip.
|
|
322
349
|
* Feature: Validation matchers support conditionals.
|
|
323
350
|
|
|
324
|
-
|
|
351
|
+
2.5.2:
|
|
325
352
|
|
|
326
353
|
* Bug Fix: Can be installed on Windows.
|
|
327
354
|
* Feature: The Fog bucket name, authentication, and host can be determined at runtime via Proc.
|
|
328
355
|
* Feature: Special characters are replaced with underscores in #url and #path.
|
|
329
356
|
|
|
330
|
-
|
|
357
|
+
2.5.1:
|
|
331
358
|
|
|
332
359
|
* Feature: After we've computed the content type, pass it to Fog.
|
|
333
360
|
* Feature: S3 encryption with the new :s3_server_side_encryption option.
|
|
334
361
|
* Feature: Works without ActiveRecord, allowing for e.g. mongo backends.
|
|
335
362
|
|
|
336
|
-
|
|
363
|
+
2.5.0:
|
|
337
364
|
|
|
338
365
|
* Performance: Only connect to S3 when absolutely needed.
|
|
339
366
|
* Bug Fix: STI with cached classes respect new options.
|