activestorage 6.1.4.1 → 7.0.0.alpha1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of activestorage might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +130 -220
- data/MIT-LICENSE +1 -1
- data/README.md +25 -11
- data/app/assets/javascripts/activestorage.esm.js +844 -0
- data/app/assets/javascripts/activestorage.js +257 -376
- data/app/controllers/active_storage/base_controller.rb +1 -10
- data/app/controllers/active_storage/blobs/proxy_controller.rb +14 -4
- data/app/controllers/active_storage/blobs/redirect_controller.rb +6 -4
- data/app/controllers/active_storage/representations/base_controller.rb +5 -1
- data/app/controllers/active_storage/representations/proxy_controller.rb +6 -4
- data/app/controllers/active_storage/representations/redirect_controller.rb +6 -4
- data/app/controllers/concerns/active_storage/set_blob.rb +6 -2
- data/app/controllers/concerns/active_storage/set_current.rb +3 -3
- data/app/controllers/concerns/active_storage/streaming.rb +65 -0
- data/app/javascript/activestorage/ujs.js +1 -1
- data/app/models/active_storage/attachment.rb +36 -3
- data/app/models/active_storage/blob/representable.rb +7 -5
- data/app/models/active_storage/blob.rb +26 -27
- data/app/models/active_storage/current.rb +12 -2
- data/app/models/active_storage/preview.rb +6 -4
- data/app/models/active_storage/record.rb +1 -1
- data/app/models/active_storage/variant.rb +3 -6
- data/app/models/active_storage/variant_record.rb +2 -0
- data/app/models/active_storage/variant_with_record.rb +9 -5
- data/app/models/active_storage/variation.rb +2 -2
- data/config/routes.rb +10 -10
- data/db/migrate/20170806125915_create_active_storage_tables.rb +29 -8
- data/db/update_migrate/20191206030411_create_active_storage_variant_records.rb +15 -2
- data/lib/active_storage/analyzer/audio_analyzer.rb +65 -0
- data/lib/active_storage/analyzer/image_analyzer/image_magick.rb +39 -0
- data/lib/active_storage/analyzer/image_analyzer/vips.rb +49 -0
- data/lib/active_storage/analyzer/image_analyzer.rb +2 -30
- data/lib/active_storage/analyzer/video_analyzer.rb +26 -11
- data/lib/active_storage/analyzer.rb +8 -4
- data/lib/active_storage/attached/changes/create_many.rb +7 -3
- data/lib/active_storage/attached/changes/create_one.rb +1 -1
- data/lib/active_storage/attached/changes/create_one_of_many.rb +1 -1
- data/lib/active_storage/attached/changes/delete_many.rb +1 -1
- data/lib/active_storage/attached/changes/delete_one.rb +1 -1
- data/lib/active_storage/attached/changes/detach_many.rb +18 -0
- data/lib/active_storage/attached/changes/detach_one.rb +24 -0
- data/lib/active_storage/attached/changes/purge_many.rb +27 -0
- data/lib/active_storage/attached/changes/purge_one.rb +27 -0
- data/lib/active_storage/attached/changes.rb +7 -1
- data/lib/active_storage/attached/many.rb +27 -15
- data/lib/active_storage/attached/model.rb +31 -5
- data/lib/active_storage/attached/one.rb +32 -27
- data/lib/active_storage/downloader.rb +2 -2
- data/lib/active_storage/engine.rb +28 -1
- data/lib/active_storage/fixture_set.rb +76 -0
- data/lib/active_storage/gem_version.rb +4 -4
- data/lib/active_storage/previewer.rb +4 -4
- data/lib/active_storage/reflection.rb +12 -2
- data/lib/active_storage/service/azure_storage_service.rb +1 -1
- data/lib/active_storage/service/configurator.rb +1 -1
- data/lib/active_storage/service/disk_service.rb +13 -18
- data/lib/active_storage/service/gcs_service.rb +91 -7
- data/lib/active_storage/service/mirror_service.rb +1 -1
- data/lib/active_storage/service/registry.rb +1 -1
- data/lib/active_storage/service/s3_service.rb +4 -4
- data/lib/active_storage/service.rb +3 -3
- data/lib/active_storage/transformers/image_processing_transformer.rb +1 -1
- data/lib/active_storage/transformers/transformer.rb +1 -1
- data/lib/active_storage.rb +3 -1
- metadata +30 -21
- data/app/controllers/concerns/active_storage/set_headers.rb +0 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c267f362a238a90819d7e7cd23917d10970b03acd2956d099ea6aeb26c2ce192
|
4
|
+
data.tar.gz: c669f3a56d9b6f3f5a08e89cfb49725d65d1abf0d7e933c50b6a3fc12c7d9a6d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cf96bff832fd497ff5475a475c2b8d5d22b12243d4126bd973ec28c670f9fb57e2e787c073c2ebf4edd89fb3a1d2fbd703a47e0f9a76490389b22e7e9483e2bd
|
7
|
+
data.tar.gz: a405ab97196c4b8c60f284b3e7c664ed30756a08abfe2d1f5d50c43630ec5cfd46d71dcd533e545151312f16459aec534a55f533be95aa6ee47021d29ce30466
|
data/CHANGELOG.md
CHANGED
@@ -1,311 +1,221 @@
|
|
1
|
-
## Rails
|
1
|
+
## Rails 7.0.0.alpha1 (September 15, 2021) ##
|
2
2
|
|
3
|
-
*
|
3
|
+
* Emit Active Support instrumentation events from Active Storage analyzers.
|
4
4
|
|
5
|
+
Fixes #42930
|
5
6
|
|
6
|
-
|
7
|
-
|
8
|
-
* The parameters sent to `ffmpeg` for generating a video preview image are now
|
9
|
-
configurable under `config.active_storage.video_preview_arguments`.
|
10
|
-
|
11
|
-
*Brendon Muir*
|
12
|
-
|
13
|
-
* Fix Active Storage update task when running in an engine.
|
14
|
-
|
15
|
-
Justin Malčić*
|
16
|
-
|
17
|
-
* Don't raise an error if the mime type is not recognized.
|
18
|
-
|
19
|
-
Fixes #41777.
|
20
|
-
|
21
|
-
*Alex Ghiculescu*
|
22
|
-
|
23
|
-
* `ActiveStorage::PreviewError` is raised when a previewer is unable to generate a preview image.
|
24
|
-
|
25
|
-
*Alex Robbin*
|
26
|
-
|
27
|
-
* respond with 404 given invalid variation key when asking for representations.
|
28
|
-
|
29
|
-
*George Claghorn*
|
30
|
-
|
31
|
-
* `Blob` creation shouldn't crash if no service selected.
|
32
|
-
|
33
|
-
*Alex Ghiculescu*
|
7
|
+
*Shouichi Kamiya*
|
34
8
|
|
9
|
+
* Add support for byte range requests
|
35
10
|
|
36
|
-
|
11
|
+
*Tom Prats*
|
37
12
|
|
38
|
-
*
|
13
|
+
* Attachments can be deleted after their association is no longer defined.
|
39
14
|
|
15
|
+
Fixes #42514
|
40
16
|
|
41
|
-
|
17
|
+
*Don Sisco*
|
42
18
|
|
43
|
-
*
|
44
|
-
mime types data.
|
19
|
+
* Make `vips` the default variant processor for new apps.
|
45
20
|
|
46
|
-
|
21
|
+
See the upgrade guide for instructions on converting from `mini_magick` to `vips`. `mini_magick` is
|
22
|
+
not deprecated, existing apps can keep using it.
|
47
23
|
|
24
|
+
*Breno Gazzola*
|
48
25
|
|
49
|
-
|
26
|
+
* Deprecate `ActiveStorage::Current.host` in favor of `ActiveStorage::Current.url_options` which accepts
|
27
|
+
a host, protocol and port.
|
50
28
|
|
51
|
-
*
|
29
|
+
*Santiago Bartesaghi*
|
52
30
|
|
31
|
+
* Allow using [IAM](https://cloud.google.com/storage/docs/access-control/signed-urls) when signing URLs with GCS.
|
53
32
|
|
54
|
-
|
33
|
+
```yaml
|
34
|
+
gcs:
|
35
|
+
service: GCS
|
36
|
+
...
|
37
|
+
iam: true
|
38
|
+
```
|
55
39
|
|
56
|
-
*
|
40
|
+
*RRethy*
|
57
41
|
|
42
|
+
* OpenSSL constants are now used for Digest computations.
|
58
43
|
|
59
|
-
|
44
|
+
*Dirkjan Bussink*
|
60
45
|
|
61
|
-
*
|
46
|
+
* Deprecate `config.active_storage.replace_on_assign_to_many`. Future versions of Rails
|
47
|
+
will behave the same way as when the config is set to `true`.
|
62
48
|
|
49
|
+
*Santiago Bartesaghi*
|
63
50
|
|
64
|
-
|
51
|
+
* Remove deprecated methods: `build_after_upload`, `create_after_upload!` in favor of `create_and_upload!`,
|
52
|
+
and `service_url` in favor of `url`.
|
65
53
|
|
66
|
-
*
|
54
|
+
*Santiago Bartesaghi*
|
67
55
|
|
68
|
-
|
56
|
+
* Add support of `strict_loading_by_default` to `ActiveStorage::Representations` controllers.
|
69
57
|
|
58
|
+
*Anton Topchii*, *Andrew White*
|
70
59
|
|
71
|
-
|
60
|
+
* Allow to detach an attachment when record is not persisted.
|
72
61
|
|
73
|
-
*
|
74
|
-
purge (`:active_storage_purge`) jobs to be the job adapter's default (`:default`).
|
62
|
+
*Jacopo Beschi*
|
75
63
|
|
76
|
-
|
64
|
+
* Use libvips instead of ImageMagick to analyze images when `active_storage.variant_processor = vips`.
|
77
65
|
|
78
|
-
*
|
66
|
+
*Breno Gazzola*
|
79
67
|
|
80
|
-
|
68
|
+
* Add metadata value for presence of video channel in video blobs.
|
81
69
|
|
82
|
-
|
70
|
+
The `metadata` attribute of video blobs has a new boolean key named `video` that is set to
|
71
|
+
`true` if the file has an video channel and `false` if it doesn't.
|
83
72
|
|
84
|
-
*
|
73
|
+
*Breno Gazzola*
|
85
74
|
|
86
|
-
*
|
75
|
+
* Deprecate usage of `purge` and `purge_later` from the association extension.
|
87
76
|
|
88
|
-
*
|
77
|
+
*Jacopo Beschi*
|
89
78
|
|
90
|
-
*
|
79
|
+
* Passing extra parameters in `ActiveStorage::Blob#url` to S3 Client.
|
91
80
|
|
92
|
-
|
81
|
+
This allows calls of `ActiveStorage::Blob#url` to have more interaction with
|
82
|
+
the S3 Presigner, enabling, amongst other options, custom S3 domain URL
|
83
|
+
Generation.
|
93
84
|
|
94
|
-
|
85
|
+
```ruby
|
86
|
+
blob = ActiveStorage::Blob.last
|
95
87
|
|
96
|
-
|
88
|
+
blob.url # => https://<bucket-name>.s3.<region>.amazonaws.com/<key>
|
89
|
+
blob.url(virtual_host: true) # => # => https://<bucket-name>/<key>
|
90
|
+
```
|
97
91
|
|
98
|
-
*
|
92
|
+
*josegomezr*
|
99
93
|
|
100
|
-
|
94
|
+
* Allow setting a `Cache-Control` on files uploaded to GCS.
|
101
95
|
|
102
|
-
|
103
|
-
|
104
|
-
|
96
|
+
```yaml
|
97
|
+
gcs:
|
98
|
+
service: GCS
|
99
|
+
...
|
100
|
+
cache_control: "public, max-age=3600"
|
101
|
+
```
|
105
102
|
|
106
|
-
*
|
103
|
+
*maleblond*
|
107
104
|
|
108
|
-
*
|
105
|
+
* The parameters sent to `ffmpeg` for generating a video preview image are now
|
106
|
+
configurable under `config.active_storage.video_preview_arguments`.
|
109
107
|
|
110
|
-
*
|
108
|
+
*Brendon Muir*
|
111
109
|
|
112
|
-
*
|
113
|
-
|
114
|
-
|
110
|
+
* The ActiveStorage video previewer will now use scene change detection to generate
|
111
|
+
better preview images (rather than the previous default of using the first frame
|
112
|
+
of the video). This change requires FFmpeg v3.4+.
|
115
113
|
|
116
|
-
|
117
|
-
<%= image_tag rails_storage_proxy_path(@user.avatar) %>
|
118
|
-
```
|
114
|
+
*Jonathan Hefner*
|
119
115
|
|
120
|
-
|
116
|
+
* Add support for ActiveStorage expiring URLs.
|
121
117
|
|
122
118
|
```ruby
|
123
|
-
|
124
|
-
config.active_storage.resolve_model_to_route = :rails_storage_proxy
|
125
|
-
```
|
119
|
+
rails_blob_path(user.avatar, disposition: "attachment", expires_in: 30.minutes)
|
126
120
|
|
127
|
-
|
128
|
-
<%= image_tag @user.avatar %>
|
121
|
+
<%= image_tag rails_blob_path(user.avatar.variant(resize: "100x100"), expires_in: 30.minutes) %>
|
129
122
|
```
|
130
123
|
|
131
|
-
|
132
|
-
is set to proxying, use the `rails_storage_redirect_path` and `_url` helpers:
|
133
|
-
|
134
|
-
```erb
|
135
|
-
<%= image_tag rails_storage_redirect_path(@user.avatar) %>
|
136
|
-
```
|
137
|
-
|
138
|
-
*Jonathan Fleckenstein*
|
139
|
-
|
140
|
-
* Add `config.active_storage.web_image_content_types` to allow applications
|
141
|
-
to add content types (like `image/webp`) in which variants can be processed,
|
142
|
-
instead of letting those images be converted to the fallback PNG format.
|
124
|
+
If you want to set default expiration time for ActiveStorage URLs throughout your application, set `config.active_storage.urls_expire_in`.
|
143
125
|
|
144
|
-
*
|
126
|
+
*aki77*
|
145
127
|
|
146
|
-
*
|
128
|
+
* Allow to purge an attachment when record is not persisted for `has_many_attached`.
|
147
129
|
|
148
|
-
*
|
130
|
+
*Jacopo Beschi*
|
149
131
|
|
150
|
-
*
|
132
|
+
* Add `with_all_variant_records` method to eager load all variant records on an attachment at once.
|
133
|
+
`with_attached_image` scope now eager loads variant records if using variant tracking.
|
151
134
|
|
152
|
-
*
|
153
|
-
|
154
|
-
* Previews are created on the same service as the original blob.
|
155
|
-
|
156
|
-
*Peter Zhu*
|
135
|
+
*Alex Ghiculescu*
|
157
136
|
|
158
|
-
*
|
137
|
+
* Add metadata value for presence of audio channel in video blobs.
|
159
138
|
|
160
|
-
|
139
|
+
The `metadata` attribute of video blobs has a new boolean key named `audio` that is set to
|
140
|
+
`true` if the file has an audio channel and `false` if it doesn't.
|
161
141
|
|
162
|
-
*
|
142
|
+
*Breno Gazzola*
|
163
143
|
|
164
|
-
|
165
|
-
`service_name` field in the generated URL in `DiskService`.
|
144
|
+
* Adds analyzer for audio files.
|
166
145
|
|
167
|
-
*
|
146
|
+
*Breno Gazzola*
|
168
147
|
|
169
|
-
*
|
148
|
+
* Respect Active Record's primary_key_type in Active Storage migrations.
|
170
149
|
|
171
|
-
*
|
150
|
+
*fatkodima*
|
172
151
|
|
173
|
-
*
|
152
|
+
* Allow `expires_in` for ActiveStorage signed ids.
|
174
153
|
|
175
|
-
|
176
|
-
`#url` method to be consistent with `Blob`.
|
154
|
+
*aki77*
|
177
155
|
|
178
|
-
|
156
|
+
* Allow to purge an attachment when record is not persisted for `has_one_attached`.
|
179
157
|
|
180
|
-
*
|
158
|
+
*Jacopo Beschi*
|
181
159
|
|
182
|
-
|
183
|
-
|
184
|
-
|
160
|
+
* Add a load hook called `active_storage_variant_record` (providing `ActiveStorage::VariantRecord`)
|
161
|
+
to allow for overriding aspects of the `ActiveStorage::VariantRecord` class. This makes
|
162
|
+
`ActiveStorage::VariantRecord` consistent with `ActiveStorage::Blob` and `ActiveStorage::Attachment`
|
163
|
+
that already have load hooks.
|
185
164
|
|
186
|
-
|
165
|
+
*Brendon Muir*
|
187
166
|
|
188
|
-
|
167
|
+
* `ActiveStorage::PreviewError` is raised when a previewer is unable to generate a preview image.
|
189
168
|
|
190
|
-
*
|
169
|
+
*Alex Robbin*
|
191
170
|
|
192
|
-
|
171
|
+
* Add `ActiveStorage::Streaming` module that can be included in a controller to get access to `#send_blob_stream`,
|
172
|
+
which wraps the new `ActionController::Base#send_stream` method to stream a blob from cloud storage:
|
193
173
|
|
194
|
-
|
174
|
+
```ruby
|
175
|
+
class MyPublicBlobsController < ApplicationController
|
176
|
+
include ActiveStorage::SetBlob, ActiveStorage::Streaming
|
177
|
+
|
178
|
+
def show
|
179
|
+
http_cache_forever(public: true) do
|
180
|
+
send_blob_stream @blob, disposition: params[:disposition]
|
181
|
+
end
|
182
|
+
end
|
183
|
+
end
|
184
|
+
```
|
195
185
|
|
196
|
-
*
|
186
|
+
*DHH*
|
197
187
|
|
198
|
-
*
|
188
|
+
* Add ability to use pre-defined variants.
|
199
189
|
|
200
190
|
```ruby
|
201
191
|
class User < ActiveRecord::Base
|
202
|
-
has_one_attached :avatar
|
192
|
+
has_one_attached :avatar do |attachable|
|
193
|
+
attachable.variant :thumb, resize: "100x100"
|
194
|
+
attachable.variant :medium, resize: "300x300", monochrome: true
|
195
|
+
end
|
203
196
|
end
|
204
197
|
|
205
198
|
class Gallery < ActiveRecord::Base
|
206
|
-
has_many_attached :photos
|
199
|
+
has_many_attached :photos do |attachable|
|
200
|
+
attachable.variant :thumb, resize: "100x100"
|
201
|
+
attachable.variant :medium, resize: "300x300", monochrome: true
|
202
|
+
end
|
207
203
|
end
|
208
|
-
```
|
209
|
-
|
210
|
-
*Dmitry Tsepelev*
|
211
|
-
|
212
|
-
* You can optionally provide a custom blob key when attaching a new file:
|
213
204
|
|
214
|
-
|
215
|
-
user.avatar.attach key: "avatars/#{user.id}.jpg",
|
216
|
-
io: io, content_type: "image/jpeg", filename: "avatar.jpg"
|
205
|
+
<%= image_tag user.avatar.variant(:thumb) %>
|
217
206
|
```
|
218
207
|
|
219
|
-
|
220
|
-
|
221
|
-
*George Claghorn*
|
222
|
-
|
223
|
-
* Replace `Blob.create_after_upload!` with `Blob.create_and_upload!` and deprecate the former.
|
224
|
-
|
225
|
-
`create_after_upload!` has been removed since it could lead to data
|
226
|
-
corruption by uploading to a key on the storage service which happened to
|
227
|
-
be already taken. Creating the record would then correctly raise a
|
228
|
-
database uniqueness exception but the stored object would already have
|
229
|
-
overwritten another. `create_and_upload!` swaps the order of operations
|
230
|
-
so that the key gets reserved up-front or the uniqueness error gets raised,
|
231
|
-
before the upload to a key takes place.
|
232
|
-
|
233
|
-
*Julik Tarkhanov*
|
234
|
-
|
235
|
-
* Set content disposition in direct upload using `filename` and `disposition` parameters to `ActiveStorage::Service#headers_for_direct_upload`.
|
236
|
-
|
237
|
-
*Peter Zhu*
|
238
|
-
|
239
|
-
* Allow record to be optionally passed to blob finders to make sharding
|
240
|
-
easier.
|
241
|
-
|
242
|
-
*Gannon McGibbon*
|
243
|
-
|
244
|
-
* Switch from `azure-storage` gem to `azure-storage-blob` gem for Azure service.
|
245
|
-
|
246
|
-
*Peter Zhu*
|
247
|
-
|
248
|
-
* Add `config.active_storage.draw_routes` to disable Active Storage routes.
|
208
|
+
*fatkodima*
|
249
209
|
|
250
|
-
|
210
|
+
* After setting `config.active_storage.resolve_model_to_route = :rails_storage_proxy`
|
211
|
+
`rails_blob_path` and `rails_representation_path` will generate proxy URLs by default.
|
251
212
|
|
252
|
-
*
|
213
|
+
*Ali Ismayilov*
|
253
214
|
|
254
|
-
|
255
|
-
|
256
|
-
failures. It now logs the error and returns `{}`, resulting in no metadata
|
257
|
-
being added to the offending image blob.
|
258
|
-
|
259
|
-
*George Claghorn*
|
260
|
-
|
261
|
-
* Method calls on singular attachments return `nil` when no file is attached.
|
262
|
-
|
263
|
-
Previously, assuming the following User model, `user.avatar.filename` would
|
264
|
-
raise a `Module::DelegationError` if no avatar was attached:
|
265
|
-
|
266
|
-
```ruby
|
267
|
-
class User < ApplicationRecord
|
268
|
-
has_one_attached :avatar
|
269
|
-
end
|
270
|
-
```
|
271
|
-
|
272
|
-
They now return `nil`.
|
273
|
-
|
274
|
-
*Matthew Tanous*
|
275
|
-
|
276
|
-
* The mirror service supports direct uploads.
|
277
|
-
|
278
|
-
New files are directly uploaded to the primary service. When a
|
279
|
-
directly-uploaded file is attached to a record, a background job is enqueued
|
280
|
-
to copy it to each secondary service.
|
281
|
-
|
282
|
-
Configure the queue used to process mirroring jobs by setting
|
283
|
-
`config.active_storage.queues.mirror`. The default is `:active_storage_mirror`.
|
284
|
-
|
285
|
-
*George Claghorn*
|
286
|
-
|
287
|
-
* The S3 service now permits uploading files larger than 5 gigabytes.
|
288
|
-
|
289
|
-
When uploading a file greater than 100 megabytes in size, the service
|
290
|
-
transparently switches to [multipart uploads](https://docs.aws.amazon.com/AmazonS3/latest/dev/mpuoverview.html)
|
291
|
-
using a part size computed from the file's total size and S3's part count limit.
|
292
|
-
|
293
|
-
No application changes are necessary to take advantage of this feature. You
|
294
|
-
can customize the default 100 MB multipart upload threshold in your S3
|
295
|
-
service's configuration:
|
296
|
-
|
297
|
-
```yaml
|
298
|
-
production:
|
299
|
-
service: s3
|
300
|
-
access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %>
|
301
|
-
secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %>
|
302
|
-
region: us-east-1
|
303
|
-
bucket: my-bucket
|
304
|
-
upload:
|
305
|
-
multipart_threshold: <%= 250.megabytes %>
|
306
|
-
```
|
215
|
+
* Declare `ActiveStorage::FixtureSet` and `ActiveStorage::FixtureSet.blob` to
|
216
|
+
improve fixture integration.
|
307
217
|
|
308
|
-
*
|
218
|
+
*Sean Doyle*
|
309
219
|
|
310
220
|
|
311
|
-
Please check [6-
|
221
|
+
Please check [6-1-stable](https://github.com/rails/rails/blob/6-1-stable/activestorage/CHANGELOG.md) for previous changes.
|