paperclip 3.5.2 → 5.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (211) hide show
  1. checksums.yaml +7 -0
  2. data/.codeclimate.yml +17 -0
  3. data/.gitignore +0 -6
  4. data/.hound.yml +1055 -0
  5. data/.rubocop.yml +1 -0
  6. data/.travis.yml +19 -13
  7. data/Appraisals +4 -16
  8. data/CONTRIBUTING.md +29 -13
  9. data/Gemfile +10 -7
  10. data/LICENSE +1 -3
  11. data/NEWS +226 -23
  12. data/README.md +494 -152
  13. data/RELEASING.md +17 -0
  14. data/Rakefile +6 -8
  15. data/UPGRADING +12 -9
  16. data/features/basic_integration.feature +27 -8
  17. data/features/migration.feature +0 -24
  18. data/features/step_definitions/attachment_steps.rb +36 -28
  19. data/features/step_definitions/html_steps.rb +2 -2
  20. data/features/step_definitions/rails_steps.rb +68 -37
  21. data/features/step_definitions/s3_steps.rb +2 -2
  22. data/features/step_definitions/web_steps.rb +1 -103
  23. data/features/support/env.rb +3 -2
  24. data/features/support/file_helpers.rb +2 -2
  25. data/features/support/fixtures/gemfile.txt +1 -1
  26. data/features/support/paths.rb +1 -1
  27. data/features/support/rails.rb +2 -25
  28. data/gemfiles/4.2.gemfile +17 -0
  29. data/gemfiles/5.0.gemfile +17 -0
  30. data/lib/generators/paperclip/paperclip_generator.rb +0 -2
  31. data/lib/generators/paperclip/templates/paperclip_migration.rb.erb +1 -1
  32. data/lib/paperclip/attachment.rb +160 -47
  33. data/lib/paperclip/attachment_registry.rb +4 -1
  34. data/lib/paperclip/callbacks.rb +13 -1
  35. data/lib/paperclip/content_type_detector.rb +26 -24
  36. data/lib/paperclip/errors.rb +8 -1
  37. data/lib/paperclip/file_command_content_type_detector.rb +6 -8
  38. data/lib/paperclip/geometry_detector_factory.rb +10 -3
  39. data/lib/paperclip/geometry_parser_factory.rb +1 -1
  40. data/lib/paperclip/glue.rb +1 -1
  41. data/lib/paperclip/has_attached_file.rb +17 -1
  42. data/lib/paperclip/helpers.rb +14 -10
  43. data/lib/paperclip/interpolations/plural_cache.rb +6 -5
  44. data/lib/paperclip/interpolations.rb +27 -14
  45. data/lib/paperclip/io_adapters/abstract_adapter.rb +28 -4
  46. data/lib/paperclip/io_adapters/attachment_adapter.rb +13 -8
  47. data/lib/paperclip/io_adapters/data_uri_adapter.rb +11 -16
  48. data/lib/paperclip/io_adapters/empty_string_adapter.rb +5 -4
  49. data/lib/paperclip/io_adapters/file_adapter.rb +12 -6
  50. data/lib/paperclip/io_adapters/http_url_proxy_adapter.rb +8 -8
  51. data/lib/paperclip/io_adapters/identity_adapter.rb +12 -6
  52. data/lib/paperclip/io_adapters/nil_adapter.rb +8 -5
  53. data/lib/paperclip/io_adapters/registry.rb +6 -2
  54. data/lib/paperclip/io_adapters/stringio_adapter.rb +15 -16
  55. data/lib/paperclip/io_adapters/uploaded_file_adapter.rb +10 -6
  56. data/lib/paperclip/io_adapters/uri_adapter.rb +41 -19
  57. data/lib/paperclip/locales/en.yml +1 -0
  58. data/lib/paperclip/matchers/have_attached_file_matcher.rb +2 -1
  59. data/lib/paperclip/matchers/validate_attachment_content_type_matcher.rb +4 -4
  60. data/lib/paperclip/matchers/validate_attachment_presence_matcher.rb +2 -1
  61. data/lib/paperclip/matchers/validate_attachment_size_matcher.rb +2 -1
  62. data/lib/paperclip/media_type_spoof_detector.rb +89 -0
  63. data/lib/paperclip/processor.rb +5 -41
  64. data/lib/paperclip/processor_helpers.rb +50 -0
  65. data/lib/paperclip/rails_environment.rb +25 -0
  66. data/lib/paperclip/schema.rb +9 -7
  67. data/lib/paperclip/storage/filesystem.rb +14 -3
  68. data/lib/paperclip/storage/fog.rb +47 -22
  69. data/lib/paperclip/storage/s3.rb +144 -73
  70. data/lib/paperclip/style.rb +8 -2
  71. data/lib/paperclip/tempfile_factory.rb +6 -4
  72. data/lib/paperclip/thumbnail.rb +26 -14
  73. data/lib/paperclip/url_generator.rb +25 -14
  74. data/lib/paperclip/validators/attachment_content_type_validator.rb +4 -0
  75. data/lib/paperclip/validators/attachment_file_name_validator.rb +80 -0
  76. data/lib/paperclip/validators/attachment_file_type_ignorance_validator.rb +29 -0
  77. data/lib/paperclip/validators/attachment_presence_validator.rb +4 -0
  78. data/lib/paperclip/validators/attachment_size_validator.rb +5 -3
  79. data/lib/paperclip/validators/media_type_spoof_detection_validator.rb +27 -0
  80. data/lib/paperclip/validators.rb +12 -3
  81. data/lib/paperclip/version.rb +3 -1
  82. data/lib/paperclip.rb +31 -11
  83. data/lib/tasks/paperclip.rake +34 -5
  84. data/paperclip.gemspec +18 -17
  85. data/shoulda_macros/paperclip.rb +13 -3
  86. data/{test → spec}/database.yml +0 -0
  87. data/spec/paperclip/attachment_definitions_spec.rb +13 -0
  88. data/{test/attachment_processing_test.rb → spec/paperclip/attachment_processing_spec.rb} +17 -20
  89. data/spec/paperclip/attachment_registry_spec.rb +158 -0
  90. data/{test/attachment_test.rb → spec/paperclip/attachment_spec.rb} +524 -400
  91. data/{test/content_type_detector_test.rb → spec/paperclip/content_type_detector_spec.rb} +17 -19
  92. data/{test/file_command_content_type_detector_test.rb → spec/paperclip/file_command_content_type_detector_spec.rb} +7 -6
  93. data/spec/paperclip/filename_cleaner_spec.rb +14 -0
  94. data/spec/paperclip/geometry_detector_spec.rb +39 -0
  95. data/{test/geometry_parser_test.rb → spec/paperclip/geometry_parser_spec.rb} +27 -27
  96. data/{test/geometry_test.rb → spec/paperclip/geometry_spec.rb} +50 -52
  97. data/spec/paperclip/glue_spec.rb +44 -0
  98. data/spec/paperclip/has_attached_file_spec.rb +158 -0
  99. data/{test/integration_test.rb → spec/paperclip/integration_spec.rb} +141 -133
  100. data/{test/interpolations_test.rb → spec/paperclip/interpolations_spec.rb} +70 -46
  101. data/spec/paperclip/io_adapters/abstract_adapter_spec.rb +101 -0
  102. data/{test/io_adapters/attachment_adapter_test.rb → spec/paperclip/io_adapters/attachment_adapter_spec.rb} +38 -34
  103. data/spec/paperclip/io_adapters/data_uri_adapter_spec.rb +89 -0
  104. data/spec/paperclip/io_adapters/empty_string_adapter_spec.rb +17 -0
  105. data/spec/paperclip/io_adapters/file_adapter_spec.rb +131 -0
  106. data/spec/paperclip/io_adapters/http_url_proxy_adapter_spec.rb +121 -0
  107. data/spec/paperclip/io_adapters/identity_adapter_spec.rb +8 -0
  108. data/{test/io_adapters/nil_adapter_test.rb → spec/paperclip/io_adapters/nil_adapter_spec.rb} +7 -7
  109. data/{test/io_adapters/registry_test.rb → spec/paperclip/io_adapters/registry_spec.rb} +12 -9
  110. data/{test/io_adapters/stringio_adapter_test.rb → spec/paperclip/io_adapters/stringio_adapter_spec.rb} +21 -18
  111. data/{test/io_adapters/uploaded_file_adapter_test.rb → spec/paperclip/io_adapters/uploaded_file_adapter_spec.rb} +46 -46
  112. data/spec/paperclip/io_adapters/uri_adapter_spec.rb +172 -0
  113. data/spec/paperclip/matchers/have_attached_file_matcher_spec.rb +19 -0
  114. data/spec/paperclip/matchers/validate_attachment_content_type_matcher_spec.rb +109 -0
  115. data/spec/paperclip/matchers/validate_attachment_presence_matcher_spec.rb +69 -0
  116. data/spec/paperclip/matchers/validate_attachment_size_matcher_spec.rb +88 -0
  117. data/spec/paperclip/media_type_spoof_detector_spec.rb +79 -0
  118. data/spec/paperclip/meta_class_spec.rb +30 -0
  119. data/spec/paperclip/paperclip_missing_attachment_styles_spec.rb +84 -0
  120. data/{test/paperclip_test.rb → spec/paperclip/paperclip_spec.rb} +46 -71
  121. data/spec/paperclip/plural_cache_spec.rb +37 -0
  122. data/spec/paperclip/processor_helpers_spec.rb +57 -0
  123. data/{test/processor_test.rb → spec/paperclip/processor_spec.rb} +5 -5
  124. data/spec/paperclip/rails_environment_spec.rb +33 -0
  125. data/{test/rake_test.rb → spec/paperclip/rake_spec.rb} +15 -15
  126. data/spec/paperclip/schema_spec.rb +248 -0
  127. data/{test/storage/filesystem_test.rb → spec/paperclip/storage/filesystem_spec.rb} +18 -18
  128. data/spec/paperclip/storage/fog_spec.rb +561 -0
  129. data/spec/paperclip/storage/s3_live_spec.rb +188 -0
  130. data/spec/paperclip/storage/s3_spec.rb +1693 -0
  131. data/spec/paperclip/style_spec.rb +255 -0
  132. data/spec/paperclip/tempfile_factory_spec.rb +33 -0
  133. data/spec/paperclip/tempfile_spec.rb +35 -0
  134. data/{test/thumbnail_test.rb → spec/paperclip/thumbnail_spec.rb} +150 -131
  135. data/spec/paperclip/url_generator_spec.rb +222 -0
  136. data/spec/paperclip/validators/attachment_content_type_validator_spec.rb +322 -0
  137. data/spec/paperclip/validators/attachment_file_name_validator_spec.rb +160 -0
  138. data/{test/validators/attachment_presence_validator_test.rb → spec/paperclip/validators/attachment_presence_validator_spec.rb} +20 -20
  139. data/{test/validators/attachment_size_validator_test.rb → spec/paperclip/validators/attachment_size_validator_spec.rb} +77 -64
  140. data/spec/paperclip/validators/media_type_spoof_detection_validator_spec.rb +52 -0
  141. data/spec/paperclip/validators_spec.rb +164 -0
  142. data/spec/spec_helper.rb +47 -0
  143. data/spec/support/assertions.rb +82 -0
  144. data/spec/support/conditional_filter_helper.rb +5 -0
  145. data/spec/support/fake_model.rb +25 -0
  146. data/spec/support/fake_rails.rb +12 -0
  147. data/{test → spec/support}/fixtures/12k.png +0 -0
  148. data/{test → spec/support}/fixtures/50x50.png +0 -0
  149. data/{test → spec/support}/fixtures/5k.png +0 -0
  150. data/{test → spec/support}/fixtures/animated +0 -0
  151. data/{test → spec/support}/fixtures/animated.gif +0 -0
  152. data/{test → spec/support}/fixtures/animated.unknown +0 -0
  153. data/{test → spec/support}/fixtures/bad.png +0 -0
  154. data/spec/support/fixtures/empty.html +1 -0
  155. data/spec/support/fixtures/empty.xlsx +0 -0
  156. data/{test → spec/support}/fixtures/fog.yml +0 -0
  157. data/{test → spec/support}/fixtures/rotated.jpg +0 -0
  158. data/{test → spec/support}/fixtures/s3.yml +0 -0
  159. data/spec/support/fixtures/spaced file.jpg +0 -0
  160. data/{test → spec/support}/fixtures/spaced file.png +0 -0
  161. data/{test → spec/support}/fixtures/text.txt +0 -0
  162. data/{test → spec/support}/fixtures/twopage.pdf +0 -0
  163. data/{test → spec/support}/fixtures/uppercase.PNG +0 -0
  164. data/spec/support/matchers/accept.rb +5 -0
  165. data/spec/support/matchers/exist.rb +5 -0
  166. data/spec/support/matchers/have_column.rb +23 -0
  167. data/{test → spec}/support/mock_attachment.rb +2 -0
  168. data/{test → spec}/support/mock_interpolator.rb +0 -0
  169. data/{test → spec}/support/mock_url_generator_builder.rb +2 -2
  170. data/spec/support/model_reconstruction.rb +68 -0
  171. data/spec/support/reporting.rb +11 -0
  172. data/spec/support/test_data.rb +13 -0
  173. data/spec/support/version_helper.rb +9 -0
  174. metadata +262 -297
  175. data/RUNNING_TESTS.md +0 -4
  176. data/cucumber/paperclip_steps.rb +0 -6
  177. data/gemfiles/3.0.gemfile +0 -11
  178. data/gemfiles/3.1.gemfile +0 -11
  179. data/gemfiles/3.2.gemfile +0 -11
  180. data/gemfiles/4.0.gemfile +0 -11
  181. data/test/attachment_definitions_test.rb +0 -12
  182. data/test/attachment_registry_test.rb +0 -77
  183. data/test/filename_cleaner_test.rb +0 -14
  184. data/test/generator_test.rb +0 -80
  185. data/test/geometry_detector_test.rb +0 -24
  186. data/test/has_attached_file_test.rb +0 -125
  187. data/test/helper.rb +0 -215
  188. data/test/io_adapters/abstract_adapter_test.rb +0 -58
  189. data/test/io_adapters/data_uri_adapter_test.rb +0 -67
  190. data/test/io_adapters/empty_string_adapter_test.rb +0 -17
  191. data/test/io_adapters/file_adapter_test.rb +0 -119
  192. data/test/io_adapters/http_url_proxy_adapter_test.rb +0 -102
  193. data/test/io_adapters/identity_adapter_test.rb +0 -8
  194. data/test/io_adapters/uri_adapter_test.rb +0 -102
  195. data/test/matchers/have_attached_file_matcher_test.rb +0 -24
  196. data/test/matchers/validate_attachment_content_type_matcher_test.rb +0 -110
  197. data/test/matchers/validate_attachment_presence_matcher_test.rb +0 -69
  198. data/test/matchers/validate_attachment_size_matcher_test.rb +0 -86
  199. data/test/meta_class_test.rb +0 -32
  200. data/test/paperclip_missing_attachment_styles_test.rb +0 -90
  201. data/test/plural_cache_test.rb +0 -36
  202. data/test/schema_test.rb +0 -200
  203. data/test/storage/fog_test.rb +0 -453
  204. data/test/storage/s3_live_test.rb +0 -179
  205. data/test/storage/s3_test.rb +0 -1348
  206. data/test/style_test.rb +0 -213
  207. data/test/support/mock_model.rb +0 -2
  208. data/test/tempfile_factory_test.rb +0 -13
  209. data/test/url_generator_test.rb +0 -187
  210. data/test/validators/attachment_content_type_validator_test.rb +0 -323
  211. data/test/validators_test.rb +0 -32
data/.rubocop.yml ADDED
@@ -0,0 +1 @@
1
+ inherit_from: .hound.yml
data/.travis.yml CHANGED
@@ -1,19 +1,25 @@
1
+ language: ruby
2
+ sudo: false
3
+
1
4
  rvm:
2
- - 1.9.2
3
- - 1.9.3
4
- - jruby-19mode
5
- - rbx-19mode
6
- - 2.0.0
5
+ - 2.1
6
+ - 2.2
7
+ - 2.3
8
+ - 2.4
9
+
10
+ script: "bundle exec rake clean spec cucumber"
7
11
 
8
- before_script: "sudo ntpdate -ub ntp.ubuntu.com pool.ntp.org; true"
9
- script: "bundle exec rake clean test cucumber"
12
+ addons:
13
+ apt:
14
+ packages:
15
+ - ghostscript
10
16
 
11
17
  gemfile:
12
- - gemfiles/3.0.gemfile
13
- - gemfiles/3.1.gemfile
14
- - gemfiles/3.2.gemfile
18
+ - gemfiles/4.2.gemfile
19
+ - gemfiles/5.0.gemfile
15
20
 
16
21
  matrix:
17
- allow_failures:
18
- - rvm: jruby-19mode
19
- - rvm: rbx-19mode
22
+ fast_finish: true
23
+ exclude:
24
+ - gemfile: gemfiles/5.0.gemfile
25
+ rvm: 2.1
data/Appraisals CHANGED
@@ -1,19 +1,7 @@
1
- appraise "3.0" do
2
- gem "rails", "~> 3.0.15"
3
- gem "paperclip", :path => "../"
1
+ appraise "4.2" do
2
+ gem "rails", "~> 4.2.0"
4
3
  end
5
4
 
6
- appraise "3.1" do
7
- gem "rails", "~> 3.1.6"
8
- gem "paperclip", :path => "../"
9
- end
10
-
11
- appraise "3.2" do
12
- gem "rails", "~> 3.2.6"
13
- gem "paperclip", :path => "../"
14
- end
15
-
16
- appraise "4.0" do
17
- gem "rails", "~> 4.0.0"
18
- gem "paperclip", :path => "../"
5
+ appraise "5.0" do
6
+ gem "rails", "~> 5.0.0"
19
7
  end
data/CONTRIBUTING.md CHANGED
@@ -1,24 +1,36 @@
1
1
  Contributing
2
2
  ============
3
3
 
4
- We love pull requests. Here's a quick guide:
4
+ We love pull requests from everyone. By participating in this project, you agree
5
+ to abide by the thoughtbot [code of conduct].
6
+
7
+ [code of conduct]: https://thoughtbot.com/open-source-code-of-conduct
8
+
9
+ Here's a quick guide for contributing:
5
10
 
6
11
  1. Fork the repo.
7
12
 
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`
13
+ 1. Make sure you have ImageMagick and Ghostscript installed. See [this section]
14
+ (./README.md#image-processor) of the README.
15
+
16
+ 1. Run the tests. We only take pull requests with passing tests, and it's great
17
+ to know that you have a clean slate: `bundle && bundle exec rake`
10
18
 
11
- 3. Add a test for your change. Only refactoring and documentation changes
19
+ 1. Add a test for your change. Only refactoring and documentation changes
12
20
  require no new tests. If you are adding functionality or fixing a bug, we need
13
21
  a test!
14
22
 
15
- 4. Make the test pass.
23
+ 1. Make the test pass.
16
24
 
17
- 5. Push to your fork and submit a pull request.
25
+ 1. Mention how your changes affect the project to other developers and users in
26
+ the `NEWS.md` file.
27
+
28
+ 1. Push to your fork and submit a pull request.
18
29
 
19
30
  At this point you're waiting on us. We like to at least comment on, if not
20
- accept, pull requests within three business days (and, typically, one business
21
- day). We may suggest some changes or improvements or alternatives.
31
+ accept, pull requests within seven business days (most of the work on Paperclip
32
+ gets done on Fridays). We may suggest some changes or improvements or
33
+ alternatives.
22
34
 
23
35
  Some things that will increase the chance that your pull request is accepted,
24
36
  taken straight from the Ruby on Rails guide:
@@ -35,27 +47,31 @@ Paperclip uses [Appraisal](https://github.com/thoughtbot/appraisal) to aid
35
47
  testing against multiple version of Ruby on Rails. This helps us to make sure
36
48
  that Paperclip performs correctly with them.
37
49
 
50
+ Paperclip also uses [RSpec](http://rspec.info) for its unit tests. If you submit
51
+ tests that are not written for Cucumber or RSpec without a very good reason, you
52
+ will be asked to rewrite them before we'll accept.
53
+
38
54
  ### Bootstrapping your test suite:
39
55
 
40
56
  bundle install
41
- bundle exec rake appraisal:install
57
+ bundle exec appraisal install
42
58
 
43
59
  This will install all the required gems that requires to test against each
44
60
  version of Rails, which defined in `gemfiles/*.gemfile`.
45
61
 
46
62
  ### To run a full test suite:
47
63
 
48
- bundle exec rake
64
+ bundle exec appraisal rake
49
65
 
50
- This will run Test::Unit and Cucumber against all version of Rails
66
+ This will run RSpec and Cucumber against all version of Rails
51
67
 
52
68
  ### To run single Test::Unit or Cucumber test
53
69
 
54
70
  You need to specify a `BUNDLE_GEMFILE` pointing to the gemfile before running
55
71
  the normal test command:
56
72
 
57
- BUNDLE_GEMFILE=gemfiles/3.2.gemfile ruby -Itest test/schema_test.rb
58
- BUNDLE_GEMFILE=gemfiles/3.2.gemfile cucumber features/basic_integration.feature
73
+ BUNDLE_GEMFILE=gemfiles/4.1.gemfile rspec spec/paperclip/attachment_spec.rb
74
+ BUNDLE_GEMFILE=gemfiles/4.1.gemfile cucumber features/basic_integration.feature
59
75
 
60
76
  Syntax
61
77
  ------
data/Gemfile CHANGED
@@ -2,12 +2,15 @@ source "https://rubygems.org"
2
2
 
3
3
  gemspec
4
4
 
5
- platform :jruby do
6
- gem 'jruby-openssl'
7
- gem 'activerecord-jdbcsqlite3-adapter'
8
- end
5
+ gem 'sqlite3', '~> 1.3.8', :platforms => :ruby
6
+ gem 'pry'
9
7
 
10
- platform :ruby do
11
- gem 'pry'
12
- gem 'pry-debugger'
8
+ # Hinting at development dependencies
9
+ # Prevents bundler from taking a long-time to resolve
10
+ group :development, :test do
11
+ gem 'activerecord-import'
12
+ gem 'mime-types'
13
+ gem 'builder'
14
+ gem 'rubocop', require: false
15
+ gem 'rspec'
13
16
  end
data/LICENSE CHANGED
@@ -3,7 +3,7 @@ LICENSE
3
3
 
4
4
  The MIT License
5
5
 
6
- Copyright (c) 2008-2013 Jon Yurek and thoughtbot, inc.
6
+ Copyright (c) 2008-2016 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
@@ -22,5 +22,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
22
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
23
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
24
  THE SOFTWARE.
25
-
26
-
data/NEWS CHANGED
@@ -1,11 +1,214 @@
1
- New in 3.5.2:
1
+ 5.2.1 (2018-01-25):
2
+
3
+ * Bugfix: Fix copying files on Windows. (#2532)
4
+
5
+ 5.2.0 (2018-01-23):
6
+
7
+ * Security: Remove the automatic loading of URI adapters. Some of these
8
+ adapters can be specially crafted to expose your network topology. (#2435)
9
+ * Bugfix: The rake task no longer rescues `Exception`. (#2476)
10
+ * Bugfix: Handle malformed `Content-Disposition` headers (#2283)
11
+ * Bugfix: The `:only_process` option works when passed a lambda again. (#2289)
12
+ * Improvement: Added `:use_accelerate_endpoint` option when using S3 to enable
13
+ [Amazon S3 Transfer Acceleration](http://docs.aws.amazon.com/AmazonS3/latest/dev/transfer-acceleration.html)
14
+ (#2291)
15
+ * Improvement: Make the fingerprint digest configurable per attachment. The
16
+ default remains MD5. Making this configurable means it can change in a future
17
+ version because it is not considered secure anymore against intentional file
18
+ corruption. For more info, see https://en.wikipedia.org/wiki/MD5#Security
19
+
20
+ You can change the digest used for an attachment by adding the
21
+ `:adapter_options` parameter to the `has_attached_file` options like this:
22
+ `has_attached_file :avatar, adapter_options: { hash_digest: Digest::SHA256 }`
23
+
24
+ Use the rake task to regenerate fingerprints with the new digest for a given
25
+ class. Note that this does **not** check the file integrity using the old
26
+ fingerprint. Run the following command to regenerate fingerprints for all
27
+ User attachments:
28
+ `CLASS=User rake paperclip:refresh:fingerprints`
29
+ You can optionally limit the attachment that will be processed, e.g:
30
+ `CLASS=User ATTACHMENT=avatar rake paperclip:refresh:fingerprints` (#2229)
31
+ * Improvement: The new `frame_index` option on the thumbnail processor allows
32
+ you to select a specific frame from an animated upload to use as a thumbnail.
33
+ Initial support is for mkv, avi, MP4, mov, MPEG, and GIF. (#2155)
34
+ * Improvement: Instead of copying files, use hard links. This is an
35
+ optimization. (#2120)
36
+ * Improvement: S3 storage option `:s3_prefixes_in_alias`. (#2287)
37
+ * Improvement: Fog option `:fog_public` can be a lambda. (#2302)
38
+ * Improvement: One fewer warning on JRuby. (#2352)
39
+
40
+ 5.1.0 (2016-08-19):
41
+
42
+ * Add default `content_type_detector` to `UploadedFileAdapter` (#2270)
43
+ * Default S3 protocol to empty string (#2038)
44
+ * Don't write original file if it wasn't reprocessed (#1993)
45
+ * Disallow trailing newlines in regular expressions (#2266)
46
+ * Support for readbyte in Paperclip attachments (#2034)
47
+ * (port from 4.3) Uri io adapter uses the content-disposition filename (#2250)
48
+ * General refactors and documentation improvements
49
+
50
+ 5.0.0 (2016-07-01):
51
+
52
+ * Improvement: Add `read_timeout` configuration for URI Adapter download_content method.
53
+ * README adjustments for Ruby beginners (add links, elucidate model in Quick Start)
54
+ * Bugfix: Now it's possible to save images from URLs with special characters [#1932]
55
+ * Bugfix: Return false when file to copy is not present in cloud storage [#2173]
56
+ * Automatically close file while checking mime type [#2016]
57
+ * Add `read_timeout` option to `UriAdapter#download_content` method [#2232]
58
+ * Fix a nil error in content type validation matcher [#1910]
59
+ * Documentation improvements
60
+
61
+ 5.0.0.beta2 (2016-04-01):
62
+
63
+ * Bugfix: Dynamic fog directory option is now respected
64
+ * Bugfix: Fixes cocaine duplicated paths [#2169]
65
+ * Removal of dead code (older versions of Rails and AWS SDK)
66
+ * README adjustments
67
+
68
+ 5.0.0.beta1 (2016-03-13):
69
+
70
+ * Bug Fix: megabytes of mime-types info in logs when a spoofed media type is detected.
71
+ * Drop support to end-of-life'd ruby 2.0.
72
+ * Drop support for end-of-life'd Rails 3.2 and 4.1
73
+ * Drop support for AWS v1
74
+ * Remove tests for JRuby and Rubinius from Travis CI (they were failing)
75
+ * Improvement: Add `fog_options` configuration to send options to fog when
76
+ storing files.
77
+ * Extracted repository for locales only: https://github.com/thoughtbot/paperclip-i18n
78
+ * Bugfix: Original file could be unlinked during `post_process_style`, producing failures
79
+ * Bugfix for image magick scaling images up
80
+ * Memory consumption improvements
81
+ * `url` on a unpersisted record returns `default_url` rather than `nil`
82
+ * Improvement: aws-sdk v2 support
83
+ https://github.com/thoughtbot/paperclip/pull/1903
84
+
85
+ If your Gemfile contains aws-sdk (>= 2.0.0) and aws-sdk-v1, paperclip will use
86
+ aws-sdk v2. With aws-sdk v2, S3 storage requires you to set the s3_region.
87
+ s3_region may be nested in s3_credentials, and (if not nested in
88
+ s3_credentials) it may be a Proc.
89
+
90
+ 4.3
91
+
92
+ See patch versions in v4.3 NEWS:
93
+ https://github.com/thoughtbot/paperclip/blob/v4.3/NEWS
94
+
95
+ 4.3.0 (2015-06-18):
96
+
97
+ * Improvement: Update aws-sdk and cucumber gem versions.
98
+ * Improvement: Add `length` alias for `size` method in AbstractAdapter.
99
+ * Improvement: Removed some cruft
100
+ * Improvement: deep_merge! Attachment definitions
101
+ * Improvement: Switch to mimemagic gem for content-type detection
102
+ * Improvement: Allows multiple content types for spoof detector
103
+ * Bug Fix: Don't assume we have Rails.env if we have Rails
104
+ * Performance: Decrease Memory footprint
105
+ * Ruby Versioning: Drop support for 1.9.3 (EOL'ed)
106
+ * Rails Versioning: Drop support for 4.0.0 (EOL'ed)
107
+
108
+ 4.2.4 (2015-06-05):
109
+
110
+ * Rollback backwards incompatible change, allowing paperclip to run on
111
+ Ruby >= 1.9.2.
112
+
113
+ 4.2.3:
114
+
115
+ * Fix dependency specifications (didn't work with Rails 4.1)
116
+ * Fix paperclip tests in CI
117
+
118
+ 4.2.2:
119
+
120
+ * Security fix: Fix a potential security issue with spoofing
121
+
122
+ 4.2.1:
123
+
124
+ * Improvement: Added `validate_media_type` options to allow/bypass spoof check
125
+ * Improvement: Added incremental backoff when AWS gives us a SlowDown error.
126
+ * Improvement: Stream downloads when usign aws-sdk.
127
+ * Improvement: Documentation fixes, includes Windows instructions.
128
+ * Improvement: Added pt-BR, zh-HK, zh-CN, zh-TW, and ja-JP locales.
129
+ * Improvement: Better escaping for characters in URLs
130
+ * Improvement: Honor `fog_credentials[:scheme]`
131
+ * Improvement: Also look for custom processors in lib/paperclip
132
+ * Improvement: id partitioning for string IDs works like integer id
133
+ * Improvement: Can pass options to DB adapters in migrations
134
+ * Improvement: Update expiring_url creation for later versions of fog
135
+ * Improvement: `path` can be a Proc in S3 attachments
136
+ * Test Fix: Improves speed and reliability of the specs
137
+ * Bug Fix: #original_filename= does not error when passed `nil`
138
+
139
+ 4.2.0:
140
+
141
+ * Improvement: Converted test suite from test/unit to RSpec
142
+ * Improvement: Refactored Paperclip::Attachment#assign
143
+ * Improvement: Added Spanish and German locales
144
+ * Improvement: Required Validators accept validator subclasses
145
+ * Improvement: EXIF orientation checking can be turned off for performance
146
+ * Improvement: Documentation updates
147
+ * Improvement: Better #human_size method for AttachmentSizeValidators
148
+ * Bug Fix: Allow MIME-types with dots in them
149
+ * Improvement: Travis CI updates
150
+ * Improvement: Validators can take multiple messages
151
+ * Improvement: Per-style options for S3 storage
152
+ * Improvement: Allow `nil` geometry strings
153
+ * Improvement: Use `eager_load!`
154
+
155
+ 4.1.1:
156
+
157
+ * Improvement: Add default translations for spoof validation
158
+ * Bug Fix: Don't check for spoofs if the file hasn't changed
159
+ * Bug Fix: Callback chain terminator is different in Rails 4.1, remove warnings
160
+ * Improvement: Fixed various Ruby warnings
161
+ * Bug Fix: Give bundler a hint, so it doesn't run forever on a fresh bundle
162
+ * Improvement: Documentation fixes
163
+ * Improvement: Allow travis-ci to finish-fast
164
+
165
+
166
+ 4.1.0:
167
+
168
+ * Improvement: Add :content_type_mappings to correct for missing spoof types
169
+ * Improvement: Credit Egor Homakov with discovering the content_type spoof bug
170
+ * Improvement: Memoize calls to identify in the thumbnail processor
171
+ * Improvement: Make MIME type optional for Data URIs.
172
+ * Improvement: Add default format for styles
173
+
174
+ 4.0.0:
175
+
176
+ * Security: Attachments are checked to make sure they're not pulling a fast one.
177
+ * Security: It is now *enforced* that every attachment has a file/mime validation.
178
+ * Bug Fix: Removed a call to IOAdapter#close that was causing issues.
179
+ * Improvement: Added bullets to the 3.5.3 list of changes. Very important.
180
+ * Improvement: Updated the copyright to 2014
181
+
182
+ 3.5.3:
183
+
184
+ * Improvement: After three long, hard years... we know how to upgrade
185
+ * Bug Fix: #expiring_url returns 'missing' urls if nothing is attached
186
+ * Improvement: Lots of documentation fixes
187
+ * Improvement: Lots of fixes for Ruby warnings
188
+ * Improvement: Test the most appropriate Ruby/Rails comobinations on Travis
189
+ * Improvement: Delegate more IO methods through IOAdapters
190
+ * Improvement: Remove Rails 4 deprecations
191
+ * Improvement: Both S3's and Fog's #expiring_url can take a Time or Int
192
+ * Bug Fix: Both S3's and Fog's expiring_url respect style when missing the file
193
+ * Bug Fix: Timefiles will have a reasonable-length name. They're all MD5 hashes now
194
+ * Bug Fix: Don't delete files off S3 when reprocessing due to AWS inconsistencies
195
+ * Bug Fix: "swallow_stream" isn't thread dafe. Use :swallow_stderr
196
+ * Improvement: Regexps use \A and \Z instead of ^ and $
197
+ * Improvement: :s3_credentials can take a lambda as an argument
198
+ * Improvement: Search up the class heirarchy for attachments
199
+ * Improvement: deep_merge options instead of regular merge
200
+ * Bug Fix: Prevent file deletion on transaction rollback
201
+ * Test Improvement: Ensure more files are properly closed during tests
202
+ * Test Bug Fix: Return the gemfile's syntax to normal
203
+
204
+ 3.5.2:
2
205
 
3
206
  * Security: Force cocaine to at least 0.5.3 to include a security fix
4
207
  * Improvement: Fixed some README exmaples
5
208
  * Feature: Added HTTP URL Proxy Adapter, can assign string URLs as attachments
6
209
  * Improvement: Put validation errors on the base attribute and the sub-attribute
7
210
 
8
- New in 3.5.1:
211
+ 3.5.1:
9
212
 
10
213
  * Bug Fix: Returned the class-level `attachment_definitions` method for compatability.
11
214
  * Improvement: Ensured compatability with Rails 4
@@ -13,7 +216,7 @@ New in 3.5.1:
13
216
  * Bug Fix: #1296, where validations were generating errors
14
217
  * Improvement: Specify MIT license in the gemspec
15
218
 
16
- New in 3.5.0:
219
+ 3.5.0:
17
220
 
18
221
  * Feature: Handle Base64-encoded data URIs as uploads
19
222
  * Feature: Add a FilenameCleaner class to allow custom filename sanitation
@@ -29,7 +232,7 @@ New in 3.5.0:
29
232
  * Improvement: Added Ruby 2.0.0 as a supported platform and removed 1.8.7
30
233
  * Improvement: Fixed some incompatabilities in the test suite
31
234
 
32
- New in 3.4.2:
235
+ 3.4.2:
33
236
 
34
237
  * Improvement: Use https for Gemfile urls
35
238
  * Improvement: Updated and more correct documentation
@@ -39,7 +242,7 @@ New in 3.4.2:
39
242
  * Improvement: Remove path clash checking, as it's unnecessary
40
243
  * Bug Fix: Do not rely on checking version numbers for aws-sdk
41
244
 
42
- New in 3.4.1:
245
+ 3.4.1:
43
246
 
44
247
  * Improvement: Various documentation fixes and improvements
45
248
  * Bug Fix: Clearing an attachment with `preserve_files` on should still clear the attachment
@@ -52,7 +255,7 @@ New in 3.4.1:
52
255
  * Improvement: Update to latest cocaine
53
256
  * Improvement: Update copyrights, various typos
54
257
 
55
- New in 3.4.0:
258
+ 3.4.0:
56
259
 
57
260
  * Bug Fix: Allow UploadedFileAdapter to force the use of `file`
58
261
  * Bug Fix: Close the file handle when dealing with URIs
@@ -82,11 +285,11 @@ New In 3.3.1:
82
285
 
83
286
  * Bug Fix: Moved Filesystem's copy_to_local_file to the right place.
84
287
 
85
- New in 3.3.0:
288
+ 3.3.0:
86
289
 
87
290
  * Improvement: Upgrade cocaine to 0.4
88
291
 
89
- New in 3.2.0:
292
+ 3.2.0:
90
293
 
91
294
  * Bug Fix: Use the new correct Amazon S3 encryption header.
92
295
  * Bug Fix: The rake task respects the updated_at column.
@@ -95,14 +298,14 @@ New in 3.2.0:
95
298
  * Feature: Automatically rotate images.
96
299
  * Feature: Reduce class-oriented programming of the attachment definitions.
97
300
 
98
- New in 3.1.4:
301
+ 3.1.4:
99
302
 
100
303
  * Bug Fix: Allow user to be able to set path without `:style` attribute and not raising an error.
101
304
  This is a regression introduced in 3.1.3, and that feature will be postponed to another minor
102
305
  release instead.
103
306
  * Feature: Allow for URI Adapter as an optional paperclip io adapter.
104
307
 
105
- New in 3.1.3:
308
+ 3.1.3:
106
309
 
107
310
  * Bug Fix: Copy empty attachment between instances is now working.
108
311
  * Bug Fix: Correctly rescue Fog error.
@@ -114,17 +317,17 @@ New in 3.1.3:
114
317
  * Bug Fix: Paperclip now gracefully handles msising file command.
115
318
  * Bug Fix: `StringIOAdapter` now accepts content type.
116
319
 
117
- New in 3.1.2:
320
+ 3.1.2:
118
321
 
119
322
  * Bug Fix: #remove_attachment on 3.1.0 and 3.1.1 mistakenly trying to remove the column that has
120
323
  the same name as data type (such as :string, :datetime, :interger.) You're advised to update to
121
324
  Paperclip 3.1.2 as soon as possible.
122
325
 
123
- New in 3.1.1:
326
+ 3.1.1:
124
327
 
125
328
  * Bug Fix: Paperclip will only load Paperclip::Schema only when Active Record is available.
126
329
 
127
- New in 3.1.0:
330
+ 3.1.0:
128
331
 
129
332
  * Feature: Paperclip now support new migration syntax (sexy migration) that reads better:
130
333
 
@@ -163,11 +366,11 @@ New in 3.1.0:
163
366
  the best_content_type to throw an error on trying nil.content_type.
164
367
  * Bug Fix: Fix problem when the gem cannot be installed on the system that has Asepsis installed.
165
368
 
166
- New in 3.0.4:
369
+ 3.0.4:
167
370
 
168
371
  * Feature: Adds support for S3 scheme-less URL generation.
169
372
 
170
- New in 3.0.3:
373
+ 3.0.3:
171
374
 
172
375
  * Bug Fix: ThumbnailProcessor now correctly detects and preserve animated GIF.
173
376
  * Bug Fix: File extension is now preserved in generated Tempfile from adapter.
@@ -190,7 +393,7 @@ New in 3.0.3:
190
393
  * Bug Fix: Fix attachment.reprocess! when using storage providers fog and s3.
191
394
  * Bug Fix: Fix a problem with incorrect content_type detected with 'file' command for an empty file on Mac.
192
395
 
193
- New in 3.0.2:
396
+ 3.0.2:
194
397
 
195
398
  * API CHANGE: Generated migration class name is now plural (AddAttachmentToUsers instead of AddAttachmentToUser)
196
399
  * API CHANGE: Remove Rails plugin initialization code.
@@ -199,13 +402,13 @@ New in 3.0.2:
199
402
  * Bug Fix: Fix a problem when there's no logger specified.
200
403
  * Bug Fix: Fix a problem when attaching Rack::Test::UploadedFile instance.
201
404
 
202
- New in 3.0.1:
405
+ 3.0.1:
203
406
 
204
407
  * Feature: Introduce Paperlip IO adapter.
205
408
  * Bug Fix: Regression in AttachmentContentTypeValidator has been fixed.
206
409
  * API CHANGE: #to_file has been removed. Use the #copy_to_local_file method instead.
207
410
 
208
- New in 3.0.0:
411
+ 3.0.0:
209
412
 
210
413
  * API CHANGE: Paperclip now requires at least Ruby on Rails version 3.0.0
211
414
  * API CHANGE: The default :url and :path have changed. The new scheme avoids
@@ -224,7 +427,7 @@ New in 3.0.0:
224
427
  * Bug Fix: File given to S3 and Fog storage will now be rewinded after flush_write.
225
428
  * Feature: You can now pass addional parameter to S3 expiring URL, such as :content_type.
226
429
 
227
- New in 2.7.0:
430
+ 2.7.0:
228
431
 
229
432
  * Bug Fix: Checking the existence of a file on S3 handles all AWS errors.
230
433
  * Bug Fix: Clear the fingerprint when removing an attachment.
@@ -233,25 +436,25 @@ New in 2.7.0:
233
436
  * Compatibility: Support for ActiveSupport < 2.3.12.
234
437
  * Compatibility: Support for Rails 3.2.
235
438
 
236
- New in 2.6.0:
439
+ 2.6.0:
237
440
 
238
441
  * Bug Fix: Files are re-wound after reading.
239
442
  * Feature: Remove Rails dependency from specs that need Paperclip.
240
443
  * Feature: Validation matchers support conditionals.
241
444
 
242
- New in 2.5.2:
445
+ 2.5.2:
243
446
 
244
447
  * Bug Fix: Can be installed on Windows.
245
448
  * Feature: The Fog bucket name, authentication, and host can be determined at runtime via Proc.
246
449
  * Feature: Special characters are replaced with underscores in #url and #path.
247
450
 
248
- New in 2.5.1:
451
+ 2.5.1:
249
452
 
250
453
  * Feature: After we've computed the content type, pass it to Fog.
251
454
  * Feature: S3 encryption with the new :s3_server_side_encryption option.
252
455
  * Feature: Works without ActiveRecord, allowing for e.g. mongo backends.
253
456
 
254
- New in 2.5.0:
457
+ 2.5.0:
255
458
 
256
459
  * Performance: Only connect to S3 when absolutely needed.
257
460
  * Bug Fix: STI with cached classes respect new options.