jr-paperclip 7.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.
Files changed (200) hide show
  1. checksums.yaml +7 -0
  2. data/.github/FUNDING.yml +3 -0
  3. data/.github/ISSUE_TEMPLATE/bug_report.md +38 -0
  4. data/.github/ISSUE_TEMPLATE/custom.md +10 -0
  5. data/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
  6. data/.github/workflows/reviewdog.yml +23 -0
  7. data/.github/workflows/test.yml +46 -0
  8. data/.gitignore +19 -0
  9. data/.qlty/.gitignore +7 -0
  10. data/.qlty/qlty.toml +89 -0
  11. data/.rubocop.yml +1060 -0
  12. data/Appraisals +29 -0
  13. data/CONTRIBUTING.md +85 -0
  14. data/Gemfile +17 -0
  15. data/LICENSE +25 -0
  16. data/NEWS +567 -0
  17. data/README.md +1083 -0
  18. data/RELEASING.md +17 -0
  19. data/Rakefile +52 -0
  20. data/bin/console +11 -0
  21. data/features/basic_integration.feature +85 -0
  22. data/features/migration.feature +29 -0
  23. data/features/rake_tasks.feature +62 -0
  24. data/features/step_definitions/attachment_steps.rb +121 -0
  25. data/features/step_definitions/html_steps.rb +15 -0
  26. data/features/step_definitions/rails_steps.rb +271 -0
  27. data/features/step_definitions/s3_steps.rb +16 -0
  28. data/features/step_definitions/web_steps.rb +106 -0
  29. data/features/support/env.rb +12 -0
  30. data/features/support/file_helpers.rb +34 -0
  31. data/features/support/fixtures/boot_config.txt +15 -0
  32. data/features/support/fixtures/gemfile.txt +5 -0
  33. data/features/support/fixtures/preinitializer.txt +20 -0
  34. data/features/support/paths.rb +28 -0
  35. data/features/support/rails.rb +39 -0
  36. data/features/support/selectors.rb +19 -0
  37. data/features/support/webmock_setup.rb +8 -0
  38. data/gemfiles/7.0.gemfile +20 -0
  39. data/gemfiles/7.1.gemfile +20 -0
  40. data/gemfiles/7.2.gemfile +20 -0
  41. data/gemfiles/8.0.gemfile +20 -0
  42. data/gemfiles/8.1.gemfile +20 -0
  43. data/lib/generators/paperclip/USAGE +8 -0
  44. data/lib/generators/paperclip/paperclip_generator.rb +36 -0
  45. data/lib/generators/paperclip/templates/paperclip_migration.rb.erb +15 -0
  46. data/lib/jr-paperclip.rb +1 -0
  47. data/lib/paperclip/attachment.rb +634 -0
  48. data/lib/paperclip/attachment_registry.rb +60 -0
  49. data/lib/paperclip/callbacks.rb +42 -0
  50. data/lib/paperclip/content_type_detector.rb +85 -0
  51. data/lib/paperclip/errors.rb +34 -0
  52. data/lib/paperclip/file_command_content_type_detector.rb +28 -0
  53. data/lib/paperclip/filename_cleaner.rb +15 -0
  54. data/lib/paperclip/geometry.rb +157 -0
  55. data/lib/paperclip/geometry_detector_factory.rb +45 -0
  56. data/lib/paperclip/geometry_parser_factory.rb +31 -0
  57. data/lib/paperclip/glue.rb +18 -0
  58. data/lib/paperclip/has_attached_file.rb +116 -0
  59. data/lib/paperclip/helpers.rb +60 -0
  60. data/lib/paperclip/interpolations/plural_cache.rb +18 -0
  61. data/lib/paperclip/interpolations.rb +205 -0
  62. data/lib/paperclip/io_adapters/abstract_adapter.rb +75 -0
  63. data/lib/paperclip/io_adapters/attachment_adapter.rb +56 -0
  64. data/lib/paperclip/io_adapters/data_uri_adapter.rb +22 -0
  65. data/lib/paperclip/io_adapters/empty_string_adapter.rb +19 -0
  66. data/lib/paperclip/io_adapters/file_adapter.rb +26 -0
  67. data/lib/paperclip/io_adapters/http_url_proxy_adapter.rb +16 -0
  68. data/lib/paperclip/io_adapters/identity_adapter.rb +17 -0
  69. data/lib/paperclip/io_adapters/nil_adapter.rb +37 -0
  70. data/lib/paperclip/io_adapters/registry.rb +36 -0
  71. data/lib/paperclip/io_adapters/stringio_adapter.rb +36 -0
  72. data/lib/paperclip/io_adapters/uploaded_file_adapter.rb +44 -0
  73. data/lib/paperclip/io_adapters/uri_adapter.rb +78 -0
  74. data/lib/paperclip/locales/en.yml +18 -0
  75. data/lib/paperclip/locales/fr.yml +18 -0
  76. data/lib/paperclip/locales/gd.yml +20 -0
  77. data/lib/paperclip/logger.rb +21 -0
  78. data/lib/paperclip/matchers/have_attached_file_matcher.rb +54 -0
  79. data/lib/paperclip/matchers/validate_attachment_content_type_matcher.rb +101 -0
  80. data/lib/paperclip/matchers/validate_attachment_presence_matcher.rb +59 -0
  81. data/lib/paperclip/matchers/validate_attachment_size_matcher.rb +97 -0
  82. data/lib/paperclip/matchers.rb +64 -0
  83. data/lib/paperclip/media_type_spoof_detector.rb +93 -0
  84. data/lib/paperclip/missing_attachment_styles.rb +84 -0
  85. data/lib/paperclip/processor.rb +56 -0
  86. data/lib/paperclip/processor_helpers.rb +52 -0
  87. data/lib/paperclip/rails_environment.rb +21 -0
  88. data/lib/paperclip/railtie.rb +31 -0
  89. data/lib/paperclip/schema.rb +104 -0
  90. data/lib/paperclip/storage/filesystem.rb +99 -0
  91. data/lib/paperclip/storage/fog.rb +262 -0
  92. data/lib/paperclip/storage/s3.rb +497 -0
  93. data/lib/paperclip/storage.rb +3 -0
  94. data/lib/paperclip/style.rb +106 -0
  95. data/lib/paperclip/tempfile.rb +42 -0
  96. data/lib/paperclip/tempfile_factory.rb +22 -0
  97. data/lib/paperclip/thumbnail.rb +131 -0
  98. data/lib/paperclip/url_generator.rb +83 -0
  99. data/lib/paperclip/validators/attachment_content_type_validator.rb +95 -0
  100. data/lib/paperclip/validators/attachment_file_name_validator.rb +82 -0
  101. data/lib/paperclip/validators/attachment_file_type_ignorance_validator.rb +28 -0
  102. data/lib/paperclip/validators/attachment_presence_validator.rb +28 -0
  103. data/lib/paperclip/validators/attachment_size_validator.rb +126 -0
  104. data/lib/paperclip/validators/media_type_spoof_detection_validator.rb +29 -0
  105. data/lib/paperclip/validators.rb +73 -0
  106. data/lib/paperclip/version.rb +3 -0
  107. data/lib/paperclip.rb +215 -0
  108. data/lib/tasks/paperclip.rake +140 -0
  109. data/paperclip.gemspec +51 -0
  110. data/shoulda_macros/paperclip.rb +134 -0
  111. data/spec/database.yml +4 -0
  112. data/spec/paperclip/attachment_definitions_spec.rb +13 -0
  113. data/spec/paperclip/attachment_processing_spec.rb +79 -0
  114. data/spec/paperclip/attachment_registry_spec.rb +158 -0
  115. data/spec/paperclip/attachment_spec.rb +1617 -0
  116. data/spec/paperclip/content_type_detector_spec.rb +58 -0
  117. data/spec/paperclip/file_command_content_type_detector_spec.rb +40 -0
  118. data/spec/paperclip/filename_cleaner_spec.rb +13 -0
  119. data/spec/paperclip/geometry_detector_spec.rb +47 -0
  120. data/spec/paperclip/geometry_parser_spec.rb +73 -0
  121. data/spec/paperclip/geometry_spec.rb +267 -0
  122. data/spec/paperclip/glue_spec.rb +63 -0
  123. data/spec/paperclip/has_attached_file_spec.rb +78 -0
  124. data/spec/paperclip/integration_spec.rb +702 -0
  125. data/spec/paperclip/interpolations_spec.rb +270 -0
  126. data/spec/paperclip/io_adapters/abstract_adapter_spec.rb +160 -0
  127. data/spec/paperclip/io_adapters/attachment_adapter_spec.rb +167 -0
  128. data/spec/paperclip/io_adapters/data_uri_adapter_spec.rb +88 -0
  129. data/spec/paperclip/io_adapters/empty_string_adapter_spec.rb +17 -0
  130. data/spec/paperclip/io_adapters/file_adapter_spec.rb +134 -0
  131. data/spec/paperclip/io_adapters/http_url_proxy_adapter_spec.rb +142 -0
  132. data/spec/paperclip/io_adapters/identity_adapter_spec.rb +8 -0
  133. data/spec/paperclip/io_adapters/nil_adapter_spec.rb +25 -0
  134. data/spec/paperclip/io_adapters/registry_spec.rb +35 -0
  135. data/spec/paperclip/io_adapters/stringio_adapter_spec.rb +64 -0
  136. data/spec/paperclip/io_adapters/uploaded_file_adapter_spec.rb +146 -0
  137. data/spec/paperclip/io_adapters/uri_adapter_spec.rb +231 -0
  138. data/spec/paperclip/matchers/have_attached_file_matcher_spec.rb +19 -0
  139. data/spec/paperclip/matchers/validate_attachment_content_type_matcher_spec.rb +108 -0
  140. data/spec/paperclip/matchers/validate_attachment_presence_matcher_spec.rb +69 -0
  141. data/spec/paperclip/matchers/validate_attachment_size_matcher_spec.rb +88 -0
  142. data/spec/paperclip/media_type_spoof_detector_spec.rb +126 -0
  143. data/spec/paperclip/meta_class_spec.rb +30 -0
  144. data/spec/paperclip/paperclip_missing_attachment_styles_spec.rb +88 -0
  145. data/spec/paperclip/paperclip_spec.rb +196 -0
  146. data/spec/paperclip/plural_cache_spec.rb +37 -0
  147. data/spec/paperclip/processor_helpers_spec.rb +57 -0
  148. data/spec/paperclip/processor_spec.rb +26 -0
  149. data/spec/paperclip/rails_environment_spec.rb +30 -0
  150. data/spec/paperclip/rake_spec.rb +103 -0
  151. data/spec/paperclip/schema_spec.rb +298 -0
  152. data/spec/paperclip/storage/filesystem_spec.rb +102 -0
  153. data/spec/paperclip/storage/fog_spec.rb +606 -0
  154. data/spec/paperclip/storage/s3_live_spec.rb +188 -0
  155. data/spec/paperclip/storage/s3_spec.rb +1974 -0
  156. data/spec/paperclip/style_spec.rb +251 -0
  157. data/spec/paperclip/tempfile_factory_spec.rb +33 -0
  158. data/spec/paperclip/tempfile_spec.rb +35 -0
  159. data/spec/paperclip/thumbnail_spec.rb +504 -0
  160. data/spec/paperclip/url_generator_spec.rb +231 -0
  161. data/spec/paperclip/validators/attachment_content_type_validator_spec.rb +410 -0
  162. data/spec/paperclip/validators/attachment_file_name_validator_spec.rb +249 -0
  163. data/spec/paperclip/validators/attachment_presence_validator_spec.rb +85 -0
  164. data/spec/paperclip/validators/attachment_size_validator_spec.rb +325 -0
  165. data/spec/paperclip/validators/media_type_spoof_detection_validator_spec.rb +48 -0
  166. data/spec/paperclip/validators_spec.rb +179 -0
  167. data/spec/spec_helper.rb +52 -0
  168. data/spec/support/assertions.rb +84 -0
  169. data/spec/support/fake_model.rb +24 -0
  170. data/spec/support/fake_rails.rb +12 -0
  171. data/spec/support/fixtures/12k.png +0 -0
  172. data/spec/support/fixtures/50x50.png +0 -0
  173. data/spec/support/fixtures/5k.png +0 -0
  174. data/spec/support/fixtures/animated +0 -0
  175. data/spec/support/fixtures/animated.gif +0 -0
  176. data/spec/support/fixtures/animated.unknown +0 -0
  177. data/spec/support/fixtures/aws_s3.yml +13 -0
  178. data/spec/support/fixtures/bad.png +1 -0
  179. data/spec/support/fixtures/empty.html +1 -0
  180. data/spec/support/fixtures/empty.xlsx +0 -0
  181. data/spec/support/fixtures/fog.yml +8 -0
  182. data/spec/support/fixtures/rotated.jpg +0 -0
  183. data/spec/support/fixtures/s3.yml +8 -0
  184. data/spec/support/fixtures/sample.xlsm +0 -0
  185. data/spec/support/fixtures/spaced file.jpg +0 -0
  186. data/spec/support/fixtures/spaced file.png +0 -0
  187. data/spec/support/fixtures/text.txt +1 -0
  188. data/spec/support/fixtures/twopage.pdf +0 -0
  189. data/spec/support/fixtures/uppercase.PNG +0 -0
  190. data/spec/support/matchers/accept.rb +5 -0
  191. data/spec/support/matchers/exist.rb +5 -0
  192. data/spec/support/matchers/have_column.rb +23 -0
  193. data/spec/support/mock_attachment.rb +24 -0
  194. data/spec/support/mock_interpolator.rb +24 -0
  195. data/spec/support/mock_url_generator_builder.rb +26 -0
  196. data/spec/support/model_reconstruction.rb +72 -0
  197. data/spec/support/reporting.rb +11 -0
  198. data/spec/support/test_data.rb +13 -0
  199. data/spec/support/version_helper.rb +9 -0
  200. metadata +702 -0
data/NEWS ADDED
@@ -0,0 +1,567 @@
1
+ 7.3.0 (2025-12-16)
2
+
3
+ * Breaking: Require Ruby >= 3.2.0 and Rails >= 7.0.0
4
+ * Feature: Add support for Rails 7.0, 7.1, 7.2, 8.0, and 8.1
5
+ * Improvement: Support aws-sdk-s3 >= 1.196.1 with TransferManager for multipart uploads/downloads
6
+ * Improvement: Fix S3 TransferManager to use configured client for region and credentials
7
+ * Improvement: Fix fog storage Pathname handling in credentials
8
+ * Improvement: Replace FakeWeb with WebMock for tests
9
+ * Improvement: Replace Travis CI with GitHub Actions
10
+ * Improvement: Fix Rails 8.x compatibility (ActiveSupport::Deprecation, schema migrations)
11
+ * Improvement: Fix MIME::Type deprecation warnings
12
+ * Improvement: Loosen marcel dependency to allow newer versions (>= 1.0.1)
13
+ * Stability: Update RuboCop configuration for latest version
14
+ * Bugfix: Remove BOM character from locale file
15
+
16
+ 7.2.1 (2023-09-09)
17
+ * Improvement: Support file extension names both as symbols and strings for :content_type_mappings
18
+
19
+ 7.2.0 (2023-05-30)
20
+ * Paperclip schema statements are consistent with ActiveRecord::Migration::Compatibility versioning. Old migrations containing Paperclip schema statements perform the same schema changes both before and after an ActiveRecord version upgrade.
21
+
22
+ 7.0.1 (2021-10-06)
23
+ * 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.
24
+
25
+ 7.0.0 (2021-05-28)
26
+ * Replace `mimemagic` gem with `marcel` due to licensing issues. See https://github.com/kreeti/kt-paperclip/pull/54 for details and limitations
27
+
28
+ 6.4.1 (2021-01-30)
29
+ * Improvement: Use URI.open in ruby > 2.5 (PR #45)
30
+
31
+ 6.4.0 (2020-12-14)
32
+ * Improvement: Fix Ruby 2.7 method & syntax deprecation warnings (#38)
33
+
34
+ 6.3.0 (2020-08-10)
35
+ * Feature: Add validation_errors_to option - customize copying of errors (#26)
36
+ * Stability: Dropped support for ruby 2.1
37
+
38
+ 6.2.2 (2020-02-18)
39
+ * Bugfix: Add support for Aliases in S3 credentials YAML (accidentally removed during 6.2.0 upgrade).
40
+
41
+ 6.2.1 (2020-01-30)
42
+
43
+ * Bugfix: Auto-loading of the gem code (necessitated due to change in gem name).
44
+
45
+ 6.2.0 (2020-01-23):
46
+
47
+ * Bugfix: Don't do post-processing on invalid attachments (#16).
48
+ * Improvement: Use AWS::S3 built in download_file method (#9).
49
+ * Stability: Rubocop recommended syntax updates (#10, #11, #13, #14).
50
+ * Stability: Testing - replace mocha and bourne with rspec mocks (#6).
51
+ * Stability: Fix test suite to run with Rails 5 and Rails 6 (#19, #20, #7).
52
+
53
+ 6.1.0 (2018-07-27):
54
+
55
+ * BUGFIX: Don't double-encode URLs (Roderick Monje).
56
+ * BUGFIX: Only use the content_type when it exists (Jean-Philippe Doyle).
57
+ * STABILITY: Better handling of the content-disposition header. Now supports
58
+ file name that is either enclosed or not in double quotes and is case
59
+ insensitive as per RC6266 grammar (Hasan Kumar, Yves Riel).
60
+ * STABILITY: Change database column type of attachment file size from unsigned 4-byte
61
+ `integer` to unsigned 8-byte `bigint`. The former type limits attachment size
62
+ to just over 2GB, which can easily be exceeded by a large video file (Laurent
63
+ Arnoud, Alen Zamanyan).
64
+ * STABILITY: Better error message when thumbnail processing errors (Hayden Ball).
65
+ * STABILITY: Fix file linking issues around Windows (Akihiko Odaki).
66
+ * STABILITY: Files without an extension will now be checked for spoofing attempts
67
+ (George Walters II).
68
+ * STABILITY: Manually close Tempfiles when we are done with them (Erkki Eilonen).
69
+
70
+ 6.0.0 (2018-03-09):
71
+
72
+ * Improvement: Depend only on `aws-sdk-s3` instead of `aws-sdk` (https://github.com/thoughtbot/paperclip/pull/2481)
73
+
74
+ 5.3.0 (2018-03-09):
75
+
76
+ * Improvement: Use `FactoryBot` instead of `FactoryGirl` (https://github.com/thoughtbot/paperclip/pull/2501)
77
+ * Improvement: README updates (https://github.com/thoughtbot/paperclip/pull/2411, https://github.com/thoughtbot/paperclip/pull/2433, https://github.com/thoughtbot/paperclip/pull/2374, https://github.com/thoughtbot/paperclip/pull/2417, https://github.com/thoughtbot/paperclip/pull/2536)
78
+ * Improvement: Remove Ruby 2.4 deprecation warning (https://github.com/thoughtbot/paperclip/pull/2401)
79
+ * Improvement: Rails 5 migration compatibility (https://github.com/thoughtbot/paperclip/pull/2470)
80
+ * Improvement: Documentation around post processing (https://github.com/thoughtbot/paperclip/pull/2381)
81
+ * Improvement: S3 hostname example documentation (https://github.com/thoughtbot/paperclip/pull/2379)
82
+ * Bugfix: Allow paperclip to load in IRB (https://github.com/thoughtbot/paperclip/pull/2369)
83
+ * Bugfix: MIME type detection (https://github.com/thoughtbot/paperclip/issues/2527)
84
+ * Bugfix: Bad tempfile state after symlink failure (https://github.com/thoughtbot/paperclip/pull/2540)
85
+ * Bugfix: Rewind file after Fog bucket creation (https://github.com/thoughtbot/paperclip/pull/2572)
86
+ * Improvement: Use `Terrapin` instead of `Cocaine` (https://github.com/thoughtbot/paperclip/pull/2553)
87
+
88
+ 5.2.1 (2018-01-25):
89
+
90
+ * Bugfix: Fix copying files on Windows. (#2532)
91
+
92
+ 5.2.0 (2018-01-23):
93
+
94
+ * Security: Remove the automatic loading of URI adapters. Some of these
95
+ adapters can be specially crafted to expose your network topology. (#2435)
96
+ * Bugfix: The rake task no longer rescues `Exception`. (#2476)
97
+ * Bugfix: Handle malformed `Content-Disposition` headers (#2283)
98
+ * Bugfix: The `:only_process` option works when passed a lambda again. (#2289)
99
+ * Improvement: Added `:use_accelerate_endpoint` option when using S3 to enable
100
+ [Amazon S3 Transfer Acceleration](http://docs.aws.amazon.com/AmazonS3/latest/dev/transfer-acceleration.html)
101
+ (#2291)
102
+ * Improvement: Make the fingerprint digest configurable per attachment. The
103
+ default remains MD5. Making this configurable means it can change in a future
104
+ version because it is not considered secure anymore against intentional file
105
+ corruption. For more info, see https://en.wikipedia.org/wiki/MD5#Security
106
+
107
+ You can change the digest used for an attachment by adding the
108
+ `:adapter_options` parameter to the `has_attached_file` options like this:
109
+ `has_attached_file :avatar, adapter_options: { hash_digest: Digest::SHA256 }`
110
+
111
+ Use the rake task to regenerate fingerprints with the new digest for a given
112
+ class. Note that this does **not** check the file integrity using the old
113
+ fingerprint. Run the following command to regenerate fingerprints for all
114
+ User attachments:
115
+ `CLASS=User rake paperclip:refresh:fingerprints`
116
+ You can optionally limit the attachment that will be processed, e.g:
117
+ `CLASS=User ATTACHMENT=avatar rake paperclip:refresh:fingerprints` (#2229)
118
+ * Improvement: The new `frame_index` option on the thumbnail processor allows
119
+ you to select a specific frame from an animated upload to use as a thumbnail.
120
+ Initial support is for mkv, avi, MP4, mov, MPEG, and GIF. (#2155)
121
+ * Improvement: Instead of copying files, use hard links. This is an
122
+ optimization. (#2120)
123
+ * Improvement: S3 storage option `:s3_prefixes_in_alias`. (#2287)
124
+ * Improvement: Fog option `:fog_public` can be a lambda. (#2302)
125
+ * Improvement: One fewer warning on JRuby. (#2352)
126
+ * Ruby 2.4.0 compatibility (doesn't use Fixnum anymore)
127
+
128
+ 5.1.0 (2016-08-19):
129
+
130
+ * Add default `content_type_detector` to `UploadedFileAdapter` (#2270)
131
+ * Default S3 protocol to empty string (#2038)
132
+ * Don't write original file if it wasn't reprocessed (#1993)
133
+ * Disallow trailing newlines in regular expressions (#2266)
134
+ * Support for readbyte in Paperclip attachments (#2034)
135
+ * (port from 4.3) Uri io adapter uses the content-disposition filename (#2250)
136
+ * General refactors and documentation improvements
137
+
138
+ 5.0.0 (2016-07-01):
139
+
140
+ * Improvement: Add `read_timeout` configuration for URI Adapter download_content method.
141
+ * README adjustments for Ruby beginners (add links, elucidate model in Quick Start)
142
+ * Bugfix: Now it's possible to save images from URLs with special characters [#1932]
143
+ * Bugfix: Return false when file to copy is not present in cloud storage [#2173]
144
+ * Automatically close file while checking mime type [#2016]
145
+ * Add `read_timeout` option to `UriAdapter#download_content` method [#2232]
146
+ * Fix a nil error in content type validation matcher [#1910]
147
+ * Documentation improvements
148
+
149
+ 5.0.0.beta2 (2016-04-01):
150
+
151
+ * Bugfix: Dynamic fog directory option is now respected
152
+ * Bugfix: Fixes cocaine duplicated paths [#2169]
153
+ * Removal of dead code (older versions of Rails and AWS SDK)
154
+ * README adjustments
155
+
156
+ 5.0.0.beta1 (2016-03-13):
157
+
158
+ * Bug Fix: megabytes of mime-types info in logs when a spoofed media type is detected.
159
+ * Drop support to end-of-life'd ruby 2.0.
160
+ * Drop support for end-of-life'd Rails 3.2 and 4.1
161
+ * Drop support for AWS v1
162
+ * Remove tests for JRuby and Rubinius from Travis CI (they were failing)
163
+ * Improvement: Add `fog_options` configuration to send options to fog when
164
+ storing files.
165
+ * Extracted repository for locales only: https://github.com/thoughtbot/paperclip-i18n
166
+ * Bugfix: Original file could be unlinked during `post_process_style`, producing failures
167
+ * Bugfix for image magick scaling images up
168
+ * Memory consumption improvements
169
+ * `url` on a unpersisted record returns `default_url` rather than `nil`
170
+ * Improvement: aws-sdk v2 support
171
+ https://github.com/thoughtbot/paperclip/pull/1903
172
+
173
+ If your Gemfile contains aws-sdk (>= 2.0.0) and aws-sdk-v1, paperclip will use
174
+ aws-sdk v2. With aws-sdk v2, S3 storage requires you to set the s3_region.
175
+ s3_region may be nested in s3_credentials, and (if not nested in
176
+ s3_credentials) it may be a Proc.
177
+
178
+ 4.3
179
+
180
+ See patch versions in v4.3 NEWS:
181
+ https://github.com/thoughtbot/paperclip/blob/v4.3/NEWS
182
+
183
+ 4.3.0 (2015-06-18):
184
+
185
+ * Improvement: Update aws-sdk and cucumber gem versions.
186
+ * Improvement: Add `length` alias for `size` method in AbstractAdapter.
187
+ * Improvement: Removed some cruft
188
+ * Improvement: deep_merge! Attachment definitions
189
+ * Improvement: Switch to mimemagic gem for content-type detection
190
+ * Improvement: Allows multiple content types for spoof detector
191
+ * Bug Fix: Don't assume we have Rails.env if we have Rails
192
+ * Performance: Decrease Memory footprint
193
+ * Ruby Versioning: Drop support for 1.9.3 (EOL'ed)
194
+ * Rails Versioning: Drop support for 4.0.0 (EOL'ed)
195
+
196
+ 4.2.4 (2015-06-05):
197
+
198
+ * Rollback backwards incompatible change, allowing paperclip to run on
199
+ Ruby >= 1.9.2.
200
+
201
+ 4.2.3:
202
+
203
+ * Fix dependency specifications (didn't work with Rails 4.1)
204
+ * Fix paperclip tests in CI
205
+
206
+ 4.2.2:
207
+
208
+ * Security fix: Fix a potential security issue with spoofing
209
+
210
+ 4.2.1:
211
+
212
+ * Improvement: Added `validate_media_type` options to allow/bypass spoof check
213
+ * Improvement: Added incremental backoff when AWS gives us a SlowDown error.
214
+ * Improvement: Stream downloads when usign aws-sdk.
215
+ * Improvement: Documentation fixes, includes Windows instructions.
216
+ * Improvement: Added pt-BR, zh-HK, zh-CN, zh-TW, and ja-JP locales.
217
+ * Improvement: Better escaping for characters in URLs
218
+ * Improvement: Honor `fog_credentials[:scheme]`
219
+ * Improvement: Also look for custom processors in lib/paperclip
220
+ * Improvement: id partitioning for string IDs works like integer id
221
+ * Improvement: Can pass options to DB adapters in migrations
222
+ * Improvement: Update expiring_url creation for later versions of fog
223
+ * Improvement: `path` can be a Proc in S3 attachments
224
+ * Test Fix: Improves speed and reliability of the specs
225
+ * Bug Fix: #original_filename= does not error when passed `nil`
226
+
227
+ 4.2.0:
228
+
229
+ * Improvement: Converted test suite from test/unit to RSpec
230
+ * Improvement: Refactored Paperclip::Attachment#assign
231
+ * Improvement: Added Spanish and German locales
232
+ * Improvement: Required Validators accept validator subclasses
233
+ * Improvement: EXIF orientation checking can be turned off for performance
234
+ * Improvement: Documentation updates
235
+ * Improvement: Better #human_size method for AttachmentSizeValidators
236
+ * Bug Fix: Allow MIME-types with dots in them
237
+ * Improvement: Travis CI updates
238
+ * Improvement: Validators can take multiple messages
239
+ * Improvement: Per-style options for S3 storage
240
+ * Improvement: Allow `nil` geometry strings
241
+ * Improvement: Use `eager_load!`
242
+
243
+ 4.1.1:
244
+
245
+ * Improvement: Add default translations for spoof validation
246
+ * Bug Fix: Don't check for spoofs if the file hasn't changed
247
+ * Bug Fix: Callback chain terminator is different in Rails 4.1, remove warnings
248
+ * Improvement: Fixed various Ruby warnings
249
+ * Bug Fix: Give bundler a hint, so it doesn't run forever on a fresh bundle
250
+ * Improvement: Documentation fixes
251
+ * Improvement: Allow travis-ci to finish-fast
252
+
253
+
254
+ 4.1.0:
255
+
256
+ * Improvement: Add :content_type_mappings to correct for missing spoof types
257
+ * Improvement: Credit Egor Homakov with discovering the content_type spoof bug
258
+ * Improvement: Memoize calls to identify in the thumbnail processor
259
+ * Improvement: Make MIME type optional for Data URIs.
260
+ * Improvement: Add default format for styles
261
+
262
+ 4.0.0:
263
+
264
+ * Security: Attachments are checked to make sure they're not pulling a fast one.
265
+ * Security: It is now *enforced* that every attachment has a file/mime validation.
266
+ * Bug Fix: Removed a call to IOAdapter#close that was causing issues.
267
+ * Improvement: Added bullets to the 3.5.3 list of changes. Very important.
268
+ * Improvement: Updated the copyright to 2014
269
+
270
+ 3.5.3:
271
+
272
+ * Improvement: After three long, hard years... we know how to upgrade
273
+ * Bug Fix: #expiring_url returns 'missing' urls if nothing is attached
274
+ * Improvement: Lots of documentation fixes
275
+ * Improvement: Lots of fixes for Ruby warnings
276
+ * Improvement: Test the most appropriate Ruby/Rails comobinations on Travis
277
+ * Improvement: Delegate more IO methods through IOAdapters
278
+ * Improvement: Remove Rails 4 deprecations
279
+ * Improvement: Both S3's and Fog's #expiring_url can take a Time or Int
280
+ * Bug Fix: Both S3's and Fog's expiring_url respect style when missing the file
281
+ * Bug Fix: Timefiles will have a reasonable-length name. They're all MD5 hashes now
282
+ * Bug Fix: Don't delete files off S3 when reprocessing due to AWS inconsistencies
283
+ * Bug Fix: "swallow_stream" isn't thread dafe. Use :swallow_stderr
284
+ * Improvement: Regexps use \A and \Z instead of ^ and $
285
+ * Improvement: :s3_credentials can take a lambda as an argument
286
+ * Improvement: Search up the class heirarchy for attachments
287
+ * Improvement: deep_merge options instead of regular merge
288
+ * Bug Fix: Prevent file deletion on transaction rollback
289
+ * Test Improvement: Ensure more files are properly closed during tests
290
+ * Test Bug Fix: Return the gemfile's syntax to normal
291
+
292
+ 3.5.2:
293
+
294
+ * Security: Force cocaine to at least 0.5.3 to include a security fix
295
+ * Improvement: Fixed some README exmaples
296
+ * Feature: Added HTTP URL Proxy Adapter, can assign string URLs as attachments
297
+ * Improvement: Put validation errors on the base attribute and the sub-attribute
298
+
299
+ 3.5.1:
300
+
301
+ * Bug Fix: Returned the class-level `attachment_definitions` method for compatability.
302
+ * Improvement: Ensured compatability with Rails 4
303
+ * Improvement: Added Rails 4 to the Appraisals
304
+ * Bug Fix: #1296, where validations were generating errors
305
+ * Improvement: Specify MIT license in the gemspec
306
+
307
+ 3.5.0:
308
+
309
+ * Feature: Handle Base64-encoded data URIs as uploads
310
+ * Feature: Add a FilenameCleaner class to allow custom filename sanitation
311
+ * Improvement: Satisfied Mocha deprecation warnings
312
+ * Bug Fix: Allow empty string to be submitted and ignored, as some forms do this
313
+ * Improvement: Make #expiring_url behavior consistent with #url
314
+ * Bug Fix: "Validate" attachments without invoking AR's validations
315
+ * Improvement: Various refactorings for a cleaner codebase
316
+ * Improvement: Be agnostic, use ActiveModel when appropriate
317
+ * Improvement: Add validation errors to the base attachment attribute
318
+ * Improvement: Handle errors in rake tasks
319
+ * Improvement: Largely refactor has_attached_file into a new class
320
+ * Improvement: Added Ruby 2.0.0 as a supported platform and removed 1.8.7
321
+ * Improvement: Fixed some incompatabilities in the test suite
322
+
323
+ 3.4.2:
324
+
325
+ * Improvement: Use https for Gemfile urls
326
+ * Improvement: Updated and more correct documentation
327
+ * Improvement: Use the -optimize flag on animated GIFs
328
+ * Improvement: Remove the Gemfile.lock
329
+ * Improvement: Add #expiring_url as an alias for #url until the storage defines it
330
+ * Improvement: Remove path clash checking, as it's unnecessary
331
+ * Bug Fix: Do not rely on checking version numbers for aws-sdk
332
+
333
+ 3.4.1:
334
+
335
+ * Improvement: Various documentation fixes and improvements
336
+ * Bug Fix: Clearing an attachment with `preserve_files` on should still clear the attachment
337
+ * Bug Fix: Instances are #changed? when a new file is assigned
338
+ * Bug Fix: Correctly deal with S3 styles when using a lambda
339
+ * Improvement: Accept and pass :credential_provider option to AWS-SDK
340
+ * Bug Fix: Sanitize original_filename more correctly in IO Adapters
341
+ * Improvement: s3_host_name can be a lambda
342
+ * Improvement: Cache some interpolations for speed
343
+ * Improvement: Update to latest cocaine
344
+ * Improvement: Update copyrights, various typos
345
+
346
+ 3.4.0:
347
+
348
+ * Bug Fix: Allow UploadedFileAdapter to force the use of `file`
349
+ * Bug Fix: Close the file handle when dealing with URIs
350
+ * Bug Fix: Ensure files are closed for writing when we're done.
351
+ * Bug Fix: Fixed 'type' being nil on Windows 7 error.
352
+ * Bug Fix: Fixed nil access when no s3 headers are defined
353
+ * Bug Fix: Fixes auto_orientation
354
+ * Bug Fix: Prevent a missing method error when switching from aws_sdk to fog
355
+ * Bug Fix: Properly fail to process invalid attachments
356
+ * Bug Fix: Server-side encryption is specified correctly
357
+ * Bug Fix: fog_public returned to true by default
358
+ * Bug Fix: Check attachment paths for duplicates, not URLs
359
+ * Feature: Add Attachment#blank?
360
+ * Feature: Add support for blacklisting certain content_types
361
+ * Feature: Add support for style-specific s3 headers and meta data
362
+ * Feature: Allow only_process to be a lambda
363
+ * Feature: Allow setting of escape url as a default option
364
+ * Feature: Create :override_file_permissions option for filesystem attachments
365
+ * Improvement: Add Attachment#as_json
366
+ * Improvement: Evaluate lambdas for fog_file properties
367
+ * Improvement: Extract geometry parsing into factories
368
+ * Improvement: Fixed various typos
369
+ * Improvement: Refactored some tests
370
+ * Improvement: Reuse S3 connections
371
+
372
+ New In 3.3.1:
373
+
374
+ * Bug Fix: Moved Filesystem's copy_to_local_file to the right place.
375
+
376
+ 3.3.0:
377
+
378
+ * Improvement: Upgrade cocaine to 0.4
379
+
380
+ 3.2.0:
381
+
382
+ * Bug Fix: Use the new correct Amazon S3 encryption header.
383
+ * Bug Fix: The rake task respects the updated_at column.
384
+ * Bug Fix: Strip newline from content type.
385
+ * Feature: Fog file visibility can be specified per style.
386
+ * Feature: Automatically rotate images.
387
+ * Feature: Reduce class-oriented programming of the attachment definitions.
388
+
389
+ 3.1.4:
390
+
391
+ * Bug Fix: Allow user to be able to set path without `:style` attribute and not raising an error.
392
+ This is a regression introduced in 3.1.3, and that feature will be postponed to another minor
393
+ release instead.
394
+ * Feature: Allow for URI Adapter as an optional paperclip io adapter.
395
+
396
+ 3.1.3:
397
+
398
+ * Bug Fix: Copy empty attachment between instances is now working.
399
+ * Bug Fix: Correctly rescue Fog error.
400
+ * Bug Fix: Using default path and url options in Fog storage now work as expected.
401
+ * Bug Fix: `Attachment#s3_protocol` now returns a protocol without colon suffix.
402
+ * Feature: Paperclip will now raise an error if multiple styles are defined but no `:style`
403
+ interpolation exists in `:path`.
404
+ * Feature: Add support for `#{attachment}_created_at` field
405
+ * Bug Fix: Paperclip now gracefully handles msising file command.
406
+ * Bug Fix: `StringIOAdapter` now accepts content type.
407
+
408
+ 3.1.2:
409
+
410
+ * Bug Fix: #remove_attachment on 3.1.0 and 3.1.1 mistakenly trying to remove the column that has
411
+ the same name as data type (such as :string, :datetime, :interger.) You're advised to update to
412
+ Paperclip 3.1.2 as soon as possible.
413
+
414
+ 3.1.1:
415
+
416
+ * Bug Fix: Paperclip will only load Paperclip::Schema only when Active Record is available.
417
+
418
+ 3.1.0:
419
+
420
+ * Feature: Paperclip now support new migration syntax (sexy migration) that reads better:
421
+
422
+ class AddAttachmentToUsers < ActiveRecord::Migration
423
+ def self.up
424
+ create_table :users do |t|
425
+ t.attachment :avatar
426
+ end
427
+ end
428
+ end
429
+
430
+ Also, schema-definition level syntax has been added:
431
+
432
+ add_attachment :users, :avatar
433
+ remove_attachment :users, :avatar
434
+
435
+ * Feature: Migration now support Rails 3.2+ `change` method.
436
+ * API CHANGE: Old `t.has_attached_file` and `drop_attached_file` are now deprecated. You're advised
437
+ to update your migration file before the next MAJOR version.
438
+ * Bug Fix: Tempfile now rewinded before generating fingerprint
439
+ * API CHANGE: Tempfiles are now unlinked after `after_flush_writes`
440
+
441
+ If you need to interact with the generated tempfiles, please define an `after_flush_writes` method
442
+ in your model. You'll be able to access files via `@queue_for_write` instance variable.
443
+
444
+ * Bug Fix: `:s3_protocol` can now be defined as either String or Symbol
445
+ * Bug Fix: Tempfiles are now rewinded before get passed into `after_flush_writes`
446
+ * Feature: Added expiring_url method to Fog Storage
447
+ * API CHANGE: Paperclip now tested against AWS::SDK 1.5.2 onward
448
+ * Bug Fix: Improved the output of the content_type validator so the actual failure is displayed
449
+ * Feature: Animated formats now identified using ImageMagick.
450
+ * Feature: AttachmentAdapter now support fetching attachment with specific style.
451
+ * Feature: Paperclip default options can now be configured in Rails.configuration.
452
+ * Feature: add Geometry#resize_to to calculate dimensions of new source.
453
+ * Bug Fix: Fixed a bug whereby a file type with multiple mime types but no official type would cause
454
+ the best_content_type to throw an error on trying nil.content_type.
455
+ * Bug Fix: Fix problem when the gem cannot be installed on the system that has Asepsis installed.
456
+
457
+ 3.0.4:
458
+
459
+ * Feature: Adds support for S3 scheme-less URL generation.
460
+
461
+ 3.0.3:
462
+
463
+ * Bug Fix: ThumbnailProcessor now correctly detects and preserve animated GIF.
464
+ * Bug Fix: File extension is now preserved in generated Tempfile from adapter.
465
+ * Bug Fix: Uploading file with unicode file name now won't raise an error when
466
+ logging in the AWS is turned on.
467
+ * Bug Fix: Task "paperclip:refresh:missing_styles" now work correctly.
468
+ * Bug Fix: Handle the case when :restricted_characters is nil.
469
+ * Bug Fix: Don't delete all the existing styles if we reprocess.
470
+ * Bug Fix: Content type is now ensured to not having a new line character.
471
+ * API CHANGE: Non-Rails usage should include Paperclip::Glue directly.
472
+
473
+ `Paperclip::Railtie` was intended to be used with Ruby on Rails only. If you're
474
+ using Paperclip without Rails, you should include `Paperclip::Glue` into
475
+ `ActiveRecord::Base` instead of requiring `paperclip/railtie`:
476
+
477
+ ActiveRecord::Base.send :include, Paperclip::Glue
478
+
479
+ * Bug Fix: AttachmentContentTypeValidator now allow you to specify :allow_blank/:allow_nil
480
+ * Bug Fix: Make sure content type always a String.
481
+ * Bug Fix: Fix attachment.reprocess! when using storage providers fog and s3.
482
+ * Bug Fix: Fix a problem with incorrect content_type detected with 'file' command for an empty file on Mac.
483
+
484
+ 3.0.2:
485
+
486
+ * API CHANGE: Generated migration class name is now plural (AddAttachmentToUsers instead of AddAttachmentToUser)
487
+ * API CHANGE: Remove Rails plugin initialization code.
488
+ * API CHANGE: Explicitly require Ruby 1.9.2 in the Gemfile.
489
+ * Bug Fix: Fixes AWS::S3::Errors::RequestTimeout on Model#save.
490
+ * Bug Fix: Fix a problem when there's no logger specified.
491
+ * Bug Fix: Fix a problem when attaching Rack::Test::UploadedFile instance.
492
+
493
+ 3.0.1:
494
+
495
+ * Feature: Introduce Paperlip IO adapter.
496
+ * Bug Fix: Regression in AttachmentContentTypeValidator has been fixed.
497
+ * API CHANGE: #to_file has been removed. Use the #copy_to_local_file method instead.
498
+
499
+ 3.0.0:
500
+
501
+ * API CHANGE: Paperclip now requires at least Ruby on Rails version 3.0.0
502
+ * API CHANGE: The default :url and :path have changed. The new scheme avoids
503
+ filesystem conflicts and scales to handle larger numbers of uploads.
504
+
505
+ The easiest way to upgrade is to add an explicit :url and :path to your
506
+ has_attached_file calls:
507
+
508
+ has_attached_file :avatar,
509
+ :path => ":rails_root/public/system/:attachment/:id/:style/:filename",
510
+ :url => "/system/:attachment/:id/:style/:filename"
511
+
512
+ * Feature: Adding Rails 3 style validators, and adding `validates_attachment` method as a shorthand.
513
+ * Bug Fix: Paperclip's rake tasks now loading records in batch.
514
+ * Bug Fix: Attachment style name with leading number now not raising an error.
515
+ * Bug Fix: File given to S3 and Fog storage will now be rewinded after flush_write.
516
+ * Feature: You can now pass addional parameter to S3 expiring URL, such as :content_type.
517
+
518
+ 2.7.0:
519
+
520
+ * Bug Fix: Checking the existence of a file on S3 handles all AWS errors.
521
+ * Bug Fix: Clear the fingerprint when removing an attachment.
522
+ * Bug Fix: Attachment size validation message reads more nicely now.
523
+ * Feature: Style names can be either symbols or strings.
524
+ * Compatibility: Support for ActiveSupport < 2.3.12.
525
+ * Compatibility: Support for Rails 3.2.
526
+
527
+ 2.6.0:
528
+
529
+ * Bug Fix: Files are re-wound after reading.
530
+ * Feature: Remove Rails dependency from specs that need Paperclip.
531
+ * Feature: Validation matchers support conditionals.
532
+
533
+ 2.5.2:
534
+
535
+ * Bug Fix: Can be installed on Windows.
536
+ * Feature: The Fog bucket name, authentication, and host can be determined at runtime via Proc.
537
+ * Feature: Special characters are replaced with underscores in #url and #path.
538
+
539
+ 2.5.1:
540
+
541
+ * Feature: After we've computed the content type, pass it to Fog.
542
+ * Feature: S3 encryption with the new :s3_server_side_encryption option.
543
+ * Feature: Works without ActiveRecord, allowing for e.g. mongo backends.
544
+
545
+ 2.5.0:
546
+
547
+ * Performance: Only connect to S3 when absolutely needed.
548
+ * Bug Fix: STI with cached classes respect new options.
549
+ * Bug Fix: conditional validations broke, and now work again.
550
+ * Feature: URL generation is now parameterized and can be changed with plugins or custom code.
551
+ * Feature: :convert_options and :source_file_options to control the ImageMagick processing.
552
+ * Performance: String geometry specifications now parse more quickly.
553
+ * Bug Fix: Handle files with question marks in the filename.
554
+ * Bug Fix: Don't raise an error when generating an expiring URL on an unassigned attachment.
555
+ * Bug Fix: The rake task runs over all instances of an ActiveRecord model, ignoring default scopes.
556
+ * Feature: DB migration has_attached_file and drop_attached_file methods.
557
+ * Bug Fix: Switch from AWS::S3 to AWS::SDK for the S3 backend.
558
+ * Bug Fix: URL generator uses '?' in the URL unless it already appears and there is no prior '='.
559
+ * Bug Fix: Always convert the content type to a string before stripping blanks.
560
+ * Feature: The :keep_old_files option preserves the files in storage even when the attachment is cleared or changed.
561
+ * Performance: Optimize Fog's public_url access by avoiding it when possible.
562
+ * Bug Fix: Avoid a runtime error when generating the ID partition for an unsaved attachment.
563
+ * Performance: Do not calculate the fingerprint if it is never persisted.
564
+ * Bug Fix: Process the :original style before all others, in case of a dependency.
565
+ * Feature: S3 headers can be set at runtime by passing a proc object as the value.
566
+ * Bug Fix: Generating missing attachment styles for a model which has had its attachment changed should not raise.
567
+ * Bug Fix: Do not collide with the built-in Ruby hashing method.