activestorage 7.0.8.7 → 7.1.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +197 -283
- data/MIT-LICENSE +1 -1
- data/README.md +6 -6
- data/app/assets/javascripts/activestorage.esm.js +11 -7
- data/app/assets/javascripts/activestorage.js +12 -6
- data/app/controllers/active_storage/disk_controller.rb +4 -2
- data/app/controllers/active_storage/representations/proxy_controller.rb +1 -1
- data/app/controllers/concerns/active_storage/file_server.rb +4 -1
- data/app/javascript/activestorage/blob_record.js +4 -1
- data/app/javascript/activestorage/direct_upload.js +3 -2
- data/app/javascript/activestorage/index.js +3 -1
- data/app/javascript/activestorage/ujs.js +3 -3
- data/app/jobs/active_storage/analyze_job.rb +1 -1
- data/app/jobs/active_storage/mirror_job.rb +1 -1
- data/app/jobs/active_storage/preview_image_job.rb +16 -0
- data/app/jobs/active_storage/purge_job.rb +1 -1
- data/app/jobs/active_storage/transform_job.rb +12 -0
- data/app/models/active_storage/attachment.rb +100 -15
- data/app/models/active_storage/blob/analyzable.rb +4 -3
- data/app/models/active_storage/blob/identifiable.rb +1 -0
- data/app/models/active_storage/blob/representable.rb +15 -3
- data/app/models/active_storage/blob/servable.rb +22 -0
- data/app/models/active_storage/blob.rb +31 -67
- data/app/models/active_storage/current.rb +0 -10
- data/app/models/active_storage/filename.rb +2 -0
- data/app/models/active_storage/named_variant.rb +21 -0
- data/app/models/active_storage/preview.rb +11 -4
- data/app/models/active_storage/variant.rb +10 -7
- data/app/models/active_storage/variant_record.rb +0 -2
- data/app/models/active_storage/variant_with_record.rb +21 -7
- data/app/models/active_storage/variation.rb +5 -3
- data/config/routes.rb +6 -4
- data/db/migrate/20170806125915_create_active_storage_tables.rb +1 -1
- data/lib/active_storage/analyzer/audio_analyzer.rb +16 -4
- data/lib/active_storage/analyzer/image_analyzer.rb +2 -0
- data/lib/active_storage/analyzer/video_analyzer.rb +3 -1
- data/lib/active_storage/analyzer.rb +2 -0
- data/lib/active_storage/attached/changes/create_many.rb +8 -3
- data/lib/active_storage/attached/changes/create_one.rb +45 -3
- data/lib/active_storage/attached/many.rb +5 -4
- data/lib/active_storage/attached/model.rb +80 -47
- data/lib/active_storage/attached/one.rb +5 -4
- data/lib/active_storage/attached.rb +2 -0
- data/lib/active_storage/deprecator.rb +7 -0
- data/lib/active_storage/engine.rb +11 -7
- data/lib/active_storage/fixture_set.rb +7 -1
- data/lib/active_storage/gem_version.rb +4 -4
- data/lib/active_storage/log_subscriber.rb +12 -0
- data/lib/active_storage/previewer.rb +8 -1
- data/lib/active_storage/reflection.rb +3 -3
- data/lib/active_storage/service/azure_storage_service.rb +2 -0
- data/lib/active_storage/service/disk_service.rb +2 -0
- data/lib/active_storage/service/gcs_service.rb +11 -20
- data/lib/active_storage/service/mirror_service.rb +10 -5
- data/lib/active_storage/service/s3_service.rb +2 -0
- data/lib/active_storage/service.rb +4 -2
- data/lib/active_storage/transformers/transformer.rb +2 -0
- data/lib/active_storage/version.rb +1 -1
- data/lib/active_storage.rb +19 -3
- metadata +17 -26
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 206c165931991ed4701825d28d46e636a5a9aa38ff25d196f14906246d95c557
|
4
|
+
data.tar.gz: de61985ef1a441eeb98646f9f0231693ee3142f3d9c9793fd7e38678e08686c7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fed89deed587674a3ea944cc1a02f8bb09c698409cc724cc1e127cf704b7ec777f45682eb88b6f455b251ceb576be00f0504c65086b0727af65cd70f1648bf0e
|
7
|
+
data.tar.gz: 678cfe23e61e1a46039cbfedb20777103203e1fdba5455a47f49ba8e21a18d2887882d1eb85d7151af4424e04da4334eee3b0b7de198dedbde73597f378899ad
|
data/CHANGELOG.md
CHANGED
@@ -1,444 +1,358 @@
|
|
1
|
-
## Rails 7.
|
1
|
+
## Rails 7.1.5.1 (December 10, 2024) ##
|
2
2
|
|
3
3
|
* No changes.
|
4
4
|
|
5
5
|
|
6
|
-
## Rails 7.
|
6
|
+
## Rails 7.1.5 (October 30, 2024) ##
|
7
7
|
|
8
8
|
* No changes.
|
9
9
|
|
10
10
|
|
11
|
-
## Rails 7.
|
11
|
+
## Rails 7.1.4.2 (October 23, 2024) ##
|
12
12
|
|
13
13
|
* No changes.
|
14
14
|
|
15
15
|
|
16
|
-
## Rails 7.
|
16
|
+
## Rails 7.1.4.1 (October 15, 2024) ##
|
17
17
|
|
18
18
|
* No changes.
|
19
19
|
|
20
20
|
|
21
|
-
## Rails 7.
|
21
|
+
## Rails 7.1.4 (August 22, 2024) ##
|
22
22
|
|
23
|
-
*
|
24
|
-
|
25
|
-
|
26
|
-
## Rails 7.0.8.2 (May 16, 2024) ##
|
27
|
-
|
28
|
-
* No changes.
|
29
|
-
|
30
|
-
|
31
|
-
## Rails 7.0.8.1 (February 21, 2024) ##
|
32
|
-
|
33
|
-
* Disables the session in `ActiveStorage::Blobs::ProxyController`
|
34
|
-
and `ActiveStorage::Representations::ProxyController`
|
35
|
-
in order to allow caching by default in some CDNs as CloudFlare
|
23
|
+
* Fixes race condition for multiple preprocessed video variants.
|
36
24
|
|
37
|
-
|
25
|
+
*Justin Searls*
|
38
26
|
|
39
|
-
*Bruno Prieto*
|
40
27
|
|
41
|
-
## Rails 7.
|
28
|
+
## Rails 7.1.3.4 (June 04, 2024) ##
|
42
29
|
|
43
30
|
* No changes.
|
44
31
|
|
45
32
|
|
46
|
-
## Rails 7.
|
33
|
+
## Rails 7.1.3.3 (May 16, 2024) ##
|
47
34
|
|
48
35
|
* No changes.
|
49
36
|
|
50
37
|
|
51
|
-
## Rails 7.
|
38
|
+
## Rails 7.1.3.2 (February 21, 2024) ##
|
52
39
|
|
53
40
|
* No changes.
|
54
41
|
|
55
42
|
|
56
|
-
## Rails 7.
|
43
|
+
## Rails 7.1.3.1 (February 21, 2024) ##
|
57
44
|
|
58
45
|
* No changes.
|
59
46
|
|
60
47
|
|
61
|
-
## Rails 7.
|
48
|
+
## Rails 7.1.3 (January 16, 2024) ##
|
62
49
|
|
63
|
-
* Fix
|
50
|
+
* Fix N+1 query when fetching preview images for non-image assets.
|
64
51
|
|
65
|
-
|
66
|
-
Instead the value can be found in side_data_list. Along with
|
67
|
-
this update it's possible to have values of -90, -270 to denote the video
|
68
|
-
has been rotated.
|
52
|
+
*Aaron Patterson & Justin Searls*
|
69
53
|
|
70
|
-
|
54
|
+
* Fix all Active Storage database related models to respect
|
55
|
+
`ActiveRecord::Base.table_name_prefix` configuration.
|
71
56
|
|
57
|
+
*Chedli Bourguiba*
|
72
58
|
|
73
|
-
|
59
|
+
* Fix `ActiveStorage::Representations::ProxyController` not returning the proper
|
60
|
+
preview image variant for previewable files.
|
74
61
|
|
75
|
-
*
|
62
|
+
*Chedli Bourguiba*
|
76
63
|
|
64
|
+
* Fix `ActiveStorage::Representations::ProxyController` to proxy untracked
|
65
|
+
variants.
|
77
66
|
|
78
|
-
|
67
|
+
*Chedli Bourguiba*
|
79
68
|
|
80
|
-
*
|
69
|
+
* Fix direct upload forms when submit button contains nested elements.
|
81
70
|
|
71
|
+
*Marc Köhlbrugge*
|
82
72
|
|
83
|
-
|
73
|
+
* When using the `preprocessed: true` option, avoid enqueuing transform jobs
|
74
|
+
for blobs that are not representable.
|
84
75
|
|
85
|
-
*
|
76
|
+
*Chedli Bourguiba*
|
86
77
|
|
78
|
+
* Process preview image variant when calling `ActiveStorage::Preview#processed`.
|
79
|
+
For example, `attached_pdf.preview(:thumb).processed` will now immediately
|
80
|
+
generate the full-sized preview image and the `:thumb` variant of it.
|
81
|
+
Previously, the `:thumb` variant would not be generated until a further call
|
82
|
+
to e.g. `processed.url`.
|
87
83
|
|
88
|
-
|
84
|
+
*Chedli Bourguiba* and *Jonathan Hefner*
|
89
85
|
|
90
|
-
*
|
86
|
+
* Prevent `ActiveRecord::StrictLoadingViolationError` when strict loading is
|
87
|
+
enabled and the variant of an Active Storage preview has already been
|
88
|
+
processed (for example, by calling `ActiveStorage::Preview#url`).
|
91
89
|
|
90
|
+
*Jonathan Hefner*
|
92
91
|
|
93
|
-
|
94
|
-
|
95
|
-
* No changes.
|
92
|
+
* Fix `preprocessed: true` option for named variants of previewable files.
|
96
93
|
|
94
|
+
*Nico Wenterodt*
|
97
95
|
|
98
|
-
## Rails 7.0.4 (September 09, 2022) ##
|
99
96
|
|
100
|
-
|
101
|
-
|
102
|
-
Previously, trying to view and/or download files larger than 5mb stored in
|
103
|
-
services like S3 via proxy mode could return corrupted files at around
|
104
|
-
5.2mb or cause random halts in the download. Now,
|
105
|
-
`ActiveStorage::Blobs::ProxyController` correctly handles streaming these
|
106
|
-
larger files from the service to the client without any issues.
|
107
|
-
|
108
|
-
Fixes #44679
|
109
|
-
|
110
|
-
*Felipe Raul*
|
111
|
-
|
112
|
-
## Rails 7.0.3.1 (July 12, 2022) ##
|
97
|
+
## Rails 7.1.2 (November 10, 2023) ##
|
113
98
|
|
114
99
|
* No changes.
|
115
100
|
|
116
101
|
|
117
|
-
## Rails 7.
|
118
|
-
|
119
|
-
* Don't stream responses in redirect mode
|
120
|
-
|
121
|
-
Previously, both redirect mode and proxy mode streamed their
|
122
|
-
responses which caused a new thread to be created, and could end
|
123
|
-
up leaking connections in the connection pool. But since redirect
|
124
|
-
mode doesn't actually send any data, it doesn't need to be
|
125
|
-
streamed.
|
126
|
-
|
127
|
-
*Luke Lau*
|
128
|
-
|
129
|
-
## Rails 7.0.2.4 (April 26, 2022) ##
|
102
|
+
## Rails 7.1.1 (October 11, 2023) ##
|
130
103
|
|
131
104
|
* No changes.
|
132
105
|
|
133
106
|
|
134
|
-
## Rails 7.0
|
135
|
-
|
136
|
-
* Added image transformation validation via configurable allow-list.
|
137
|
-
|
138
|
-
Variant now offers a configurable allow-list for
|
139
|
-
transformation methods in addition to a configurable deny-list for arguments.
|
140
|
-
|
141
|
-
[CVE-2022-21831]
|
142
|
-
|
143
|
-
|
144
|
-
## Rails 7.0.2.2 (February 11, 2022) ##
|
145
|
-
|
146
|
-
* No changes.
|
147
|
-
|
148
|
-
## Rails 7.0.2.1 (February 11, 2022) ##
|
107
|
+
## Rails 7.1.0 (October 05, 2023) ##
|
149
108
|
|
150
109
|
* No changes.
|
151
110
|
|
152
111
|
|
153
|
-
## Rails 7.0.
|
154
|
-
|
155
|
-
* Revert the ability to pass `service_name` param to `DirectUploadsController` which was introduced
|
156
|
-
in 7.0.0.
|
157
|
-
|
158
|
-
That change caused a lot of problems to upgrade Rails applications so we decided to remove it
|
159
|
-
while in work in a more backwards compatible implementation.
|
160
|
-
|
161
|
-
*Gannon McGibbon*
|
162
|
-
|
163
|
-
* Allow applications to opt out of precompiling Active Storage JavaScript assets.
|
164
|
-
|
165
|
-
*jlestavel*
|
166
|
-
|
167
|
-
|
168
|
-
## Rails 7.0.1 (January 06, 2022) ##
|
112
|
+
## Rails 7.1.0.rc2 (October 01, 2023) ##
|
169
113
|
|
170
114
|
* No changes.
|
171
115
|
|
172
116
|
|
173
|
-
## Rails 7.0.
|
117
|
+
## Rails 7.1.0.rc1 (September 27, 2023) ##
|
174
118
|
|
175
|
-
*
|
119
|
+
* Add `expires_at` option to `ActiveStorage::Blob#signed_id`.
|
176
120
|
|
177
121
|
```ruby
|
178
|
-
|
179
|
-
|
122
|
+
rails_blob_path(user.avatar, disposition: "attachment", expires_at: 30.minutes.from_now)
|
123
|
+
<%= image_tag rails_blob_path(user.avatar.variant(resize: "100x100"), expires_at: 30.minutes.from_now) %>
|
180
124
|
```
|
181
125
|
|
182
|
-
*
|
183
|
-
|
126
|
+
*Aki*
|
184
127
|
|
185
|
-
|
128
|
+
* Allow attaching File and Pathname when assigning attributes, e.g.
|
186
129
|
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
* No changes.
|
193
|
-
|
194
|
-
## Rails 7.0.0.rc1 (December 06, 2021) ##
|
195
|
-
|
196
|
-
* `Add ActiveStorage::Blob.compose` to concatenate multiple blobs.
|
197
|
-
|
198
|
-
*Gannon McGibbon*
|
199
|
-
|
200
|
-
* Setting custom metadata on blobs are now persisted to remote storage.
|
201
|
-
|
202
|
-
*joshuamsager*
|
203
|
-
|
204
|
-
* Support direct uploads to multiple services.
|
130
|
+
```ruby
|
131
|
+
User.create!(avatar: File.open("image.jpg"))
|
132
|
+
User.create!(avatar: file_fixture("image.jpg"))
|
133
|
+
```
|
205
134
|
|
206
|
-
*
|
135
|
+
*Dorian Marié*
|
207
136
|
|
208
|
-
* Invalid default content types are deprecated
|
209
137
|
|
210
|
-
|
211
|
-
a deprecation warning, since these are not valid content types.
|
138
|
+
## Rails 7.1.0.beta1 (September 13, 2023) ##
|
212
139
|
|
213
|
-
|
140
|
+
* Disables the session in `ActiveStorage::Blobs::ProxyController`
|
141
|
+
and `ActiveStorage::Representations::ProxyController`
|
142
|
+
in order to allow caching by default in some CDNs as CloudFlare
|
214
143
|
|
215
|
-
|
144
|
+
Fixes #44136
|
216
145
|
|
217
|
-
*
|
146
|
+
*Bruno Prieto*
|
218
147
|
|
219
|
-
|
148
|
+
* Add `tags` to `ActiveStorage::Analyzer::AudioAnalyzer` output
|
220
149
|
|
221
|
-
*
|
150
|
+
*Keaton Roux*
|
222
151
|
|
152
|
+
* Add an option to preprocess variants
|
223
153
|
|
224
|
-
|
154
|
+
ActiveStorage variants are processed on the fly when they are needed but
|
155
|
+
sometimes we're sure that they are accessed and want to processed them
|
156
|
+
upfront.
|
225
157
|
|
226
|
-
|
158
|
+
`preprocessed` option is added when declaring variants.
|
227
159
|
|
228
|
-
|
160
|
+
```
|
161
|
+
class User < ApplicationRecord
|
162
|
+
has_one_attached :avatar do |attachable|
|
163
|
+
attachable.variant :thumb, resize_to_limit: [100, 100], preprocessed: true
|
164
|
+
end
|
165
|
+
end
|
166
|
+
```
|
229
167
|
|
230
168
|
*Shouichi Kamiya*
|
231
169
|
|
232
|
-
*
|
170
|
+
* Fix variants not included when eager loading multiple records containing a single attachment
|
233
171
|
|
234
|
-
|
172
|
+
When using the `with_attached_#{name}` scope for a `has_one_attached` relation,
|
173
|
+
attachment variants were not eagerly loaded.
|
235
174
|
|
236
|
-
*
|
175
|
+
*Russell Porter*
|
237
176
|
|
238
|
-
|
177
|
+
* Allow an ActiveStorage attachment to be removed via a form post
|
239
178
|
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
See the upgrade guide for instructions on converting from `mini_magick` to `vips`. `mini_magick` is
|
245
|
-
not deprecated, existing apps can keep using it.
|
246
|
-
|
247
|
-
*Breno Gazzola*
|
248
|
-
|
249
|
-
* Deprecate `ActiveStorage::Current.host` in favor of `ActiveStorage::Current.url_options` which accepts
|
250
|
-
a host, protocol and port.
|
179
|
+
Attachments can already be removed by updating the attachment to be nil such as:
|
180
|
+
```ruby
|
181
|
+
User.find(params[:id]).update!(avatar: nil)
|
182
|
+
```
|
251
183
|
|
252
|
-
|
184
|
+
However, a form cannot post a nil param, it can only post an empty string. But, posting an
|
185
|
+
empty string would result in an `ActiveSupport::MessageVerifier::InvalidSignature: mismatched digest`
|
186
|
+
error being raised, because it's being treated as a signed blob id.
|
253
187
|
|
254
|
-
|
188
|
+
Now, nil and an empty string are treated as a delete, which allows attachments to be removed via:
|
189
|
+
```ruby
|
190
|
+
User.find(params[:id]).update!(params.require(:user).permit(:avatar))
|
255
191
|
|
256
|
-
```yaml
|
257
|
-
gcs:
|
258
|
-
service: GCS
|
259
|
-
...
|
260
|
-
iam: true
|
261
192
|
```
|
262
193
|
|
263
|
-
*
|
194
|
+
*Nate Matykiewicz*
|
264
195
|
|
265
|
-
*
|
196
|
+
* Remove mini_mime usage in favour of marcel.
|
266
197
|
|
267
|
-
|
198
|
+
We have two libraries that are have similar usage. This change removes
|
199
|
+
dependency on mini_mime and makes use of similar methods from marcel.
|
268
200
|
|
269
|
-
*
|
270
|
-
will behave the same way as when the config is set to `true`.
|
271
|
-
|
272
|
-
*Santiago Bartesaghi*
|
201
|
+
*Vipul A M*
|
273
202
|
|
274
|
-
*
|
275
|
-
and `service_url` in favor of `url`.
|
203
|
+
* Allow destroying active storage variants
|
276
204
|
|
277
|
-
|
278
|
-
|
279
|
-
|
205
|
+
```ruby
|
206
|
+
User.first.avatar.variant(resize_to_limit: [100, 100]).destroy
|
207
|
+
```
|
280
208
|
|
281
|
-
*
|
209
|
+
*Shouichi Kamiya*, *Yuichiro NAKAGAWA*, *Ryohei UEDA*
|
282
210
|
|
283
|
-
*
|
211
|
+
* Add `sample_rate` to `ActiveStorage::Analyzer::AudioAnalyzer` output
|
284
212
|
|
285
|
-
*
|
213
|
+
*Matija Čupić*
|
286
214
|
|
287
|
-
*
|
215
|
+
* Remove deprecated `purge` and `purge_later` methods from the attachments association.
|
288
216
|
|
289
|
-
*
|
217
|
+
*Rafael Mendonça França*
|
290
218
|
|
291
|
-
*
|
219
|
+
* Remove deprecated behavior when assigning to a collection of attachments.
|
292
220
|
|
293
|
-
|
294
|
-
`true` if the file has an video channel and `false` if it doesn't.
|
221
|
+
Instead of appending to the collection, the collection is now replaced.
|
295
222
|
|
296
|
-
*
|
223
|
+
*Rafael Mendonça França*
|
297
224
|
|
298
|
-
*
|
225
|
+
* Remove deprecated `ActiveStorage::Current#host` and `ActiveStorage::Current#host=` methods.
|
299
226
|
|
300
|
-
*
|
227
|
+
*Rafael Mendonça França*
|
301
228
|
|
302
|
-
*
|
229
|
+
* Remove deprecated invalid default content types in Active Storage configurations.
|
303
230
|
|
304
|
-
|
305
|
-
the S3 Presigner, enabling, amongst other options, custom S3 domain URL
|
306
|
-
Generation.
|
231
|
+
*Rafael Mendonça França*
|
307
232
|
|
308
|
-
|
309
|
-
blob = ActiveStorage::Blob.last
|
233
|
+
* Add missing preview event to `ActiveStorage::LogSubscriber`
|
310
234
|
|
311
|
-
|
312
|
-
|
313
|
-
```
|
235
|
+
A `preview` event is being instrumented in `ActiveStorage::Previewer`.
|
236
|
+
However it was not added inside ActiveStorage's LogSubscriber class.
|
314
237
|
|
315
|
-
|
238
|
+
This will allow to have logs for when a preview happens
|
239
|
+
in the same fashion as all other ActiveStorage events such as
|
240
|
+
`upload` and `download` inside `Rails.logger`.
|
316
241
|
|
317
|
-
*
|
242
|
+
*Chedli Bourguiba*
|
318
243
|
|
319
|
-
|
320
|
-
gcs:
|
321
|
-
service: GCS
|
322
|
-
...
|
323
|
-
cache_control: "public, max-age=3600"
|
324
|
-
```
|
244
|
+
* Fix retrieving rotation value from FFmpeg on version 5.0+.
|
325
245
|
|
326
|
-
|
246
|
+
In FFmpeg version 5.0+ the rotation value has been removed from tags.
|
247
|
+
Instead the value can be found in side_data_list. Along with
|
248
|
+
this update it's possible to have values of -90, -270 to denote the video
|
249
|
+
has been rotated.
|
327
250
|
|
328
|
-
*
|
329
|
-
configurable under `config.active_storage.video_preview_arguments`.
|
251
|
+
*Haroon Ahmed*
|
330
252
|
|
331
|
-
|
253
|
+
* Touch all corresponding model records after ActiveStorage::Blob is analyzed
|
332
254
|
|
333
|
-
|
334
|
-
|
335
|
-
|
255
|
+
This fixes a race condition where a record can be requested and have a cache entry built, before
|
256
|
+
the initial `analyze_later` completes, which will not be invalidated until something else
|
257
|
+
updates the record. This also invalidates cache entries when a blob is re-analyzed, which
|
258
|
+
is helpful if a bug is fixed in an analyzer or a new analyzer is added.
|
336
259
|
|
337
|
-
*
|
260
|
+
*Nate Matykiewicz*
|
338
261
|
|
339
|
-
* Add
|
262
|
+
* Add ability to use pre-defined variants when calling `preview` or
|
263
|
+
`representation` on an attachment.
|
340
264
|
|
341
265
|
```ruby
|
342
|
-
|
266
|
+
class User < ActiveRecord::Base
|
267
|
+
has_one_attached :file do |attachable|
|
268
|
+
attachable.variant :thumb, resize_to_limit: [100, 100]
|
269
|
+
end
|
270
|
+
end
|
343
271
|
|
344
|
-
<%= image_tag
|
272
|
+
<%= image_tag user.file.representation(:thumb) %>
|
345
273
|
```
|
346
274
|
|
347
|
-
|
348
|
-
|
349
|
-
*aki77*
|
350
|
-
|
351
|
-
* Allow to purge an attachment when record is not persisted for `has_many_attached`.
|
275
|
+
*Richard Böhme*
|
352
276
|
|
353
|
-
|
277
|
+
* Method `attach` always returns the attachments except when the record
|
278
|
+
is persisted, unchanged, and saving it fails, in which case it returns `nil`.
|
354
279
|
|
355
|
-
*
|
356
|
-
`with_attached_image` scope now eager loads variant records if using variant tracking.
|
357
|
-
|
358
|
-
*Alex Ghiculescu*
|
359
|
-
|
360
|
-
* Add metadata value for presence of audio channel in video blobs.
|
361
|
-
|
362
|
-
The `metadata` attribute of video blobs has a new boolean key named `audio` that is set to
|
363
|
-
`true` if the file has an audio channel and `false` if it doesn't.
|
364
|
-
|
365
|
-
*Breno Gazzola*
|
366
|
-
|
367
|
-
* Adds analyzer for audio files.
|
368
|
-
|
369
|
-
*Breno Gazzola*
|
370
|
-
|
371
|
-
* Respect Active Record's primary_key_type in Active Storage migrations.
|
372
|
-
|
373
|
-
*fatkodima*
|
280
|
+
*Santiago Bartesaghi*
|
374
281
|
|
375
|
-
*
|
282
|
+
* Fixes multiple `attach` calls within transaction not uploading files correctly.
|
376
283
|
|
377
|
-
|
284
|
+
In the following example, the code failed to upload all but the last file to the configured service.
|
285
|
+
```ruby
|
286
|
+
ActiveRecord::Base.transaction do
|
287
|
+
user.attachments.attach({
|
288
|
+
content_type: "text/plain",
|
289
|
+
filename: "dummy.txt",
|
290
|
+
io: ::StringIO.new("dummy"),
|
291
|
+
})
|
292
|
+
user.attachments.attach({
|
293
|
+
content_type: "text/plain",
|
294
|
+
filename: "dummy2.txt",
|
295
|
+
io: ::StringIO.new("dummy2"),
|
296
|
+
})
|
297
|
+
end
|
378
298
|
|
379
|
-
|
299
|
+
assert_equal 2, user.attachments.count
|
300
|
+
assert user.attachments.first.service.exist?(user.attachments.first.key) # Fails
|
301
|
+
```
|
380
302
|
|
381
|
-
|
303
|
+
This was addressed by keeping track of the subchanges pending upload, and uploading them
|
304
|
+
once the transaction is committed.
|
382
305
|
|
383
|
-
|
384
|
-
to allow for overriding aspects of the `ActiveStorage::VariantRecord` class. This makes
|
385
|
-
`ActiveStorage::VariantRecord` consistent with `ActiveStorage::Blob` and `ActiveStorage::Attachment`
|
386
|
-
that already have load hooks.
|
306
|
+
Fixes #41661
|
387
307
|
|
388
|
-
*
|
308
|
+
*Santiago Bartesaghi*, *Bruno Vezoli*, *Juan Roig*, *Abhay Nikam*
|
389
309
|
|
390
|
-
*
|
310
|
+
* Raise an exception if `config.active_storage.service` is not set.
|
391
311
|
|
392
|
-
|
312
|
+
If Active Storage is configured and `config.active_storage.service` is not
|
313
|
+
set in the respective environment's configuration file, then an exception
|
314
|
+
is raised with a meaningful message when attempting to use Active Storage.
|
393
315
|
|
394
|
-
*
|
395
|
-
which wraps the new `ActionController::Base#send_stream` method to stream a blob from cloud storage:
|
316
|
+
*Ghouse Mohamed*
|
396
317
|
|
397
|
-
|
398
|
-
class MyPublicBlobsController < ApplicationController
|
399
|
-
include ActiveStorage::SetBlob, ActiveStorage::Streaming
|
318
|
+
* Fixes proxy downloads of files over 5mb
|
400
319
|
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
end
|
407
|
-
```
|
320
|
+
Previously, trying to view and/or download files larger than 5mb stored in
|
321
|
+
services like S3 via proxy mode could return corrupted files at around
|
322
|
+
5.2mb or cause random halts in the download. Now,
|
323
|
+
`ActiveStorage::Blobs::ProxyController` correctly handles streaming these
|
324
|
+
larger files from the service to the client without any issues.
|
408
325
|
|
409
|
-
|
326
|
+
Fixes #44679
|
410
327
|
|
411
|
-
*
|
328
|
+
*Felipe Raul*
|
412
329
|
|
413
|
-
|
414
|
-
class User < ActiveRecord::Base
|
415
|
-
has_one_attached :avatar do |attachable|
|
416
|
-
attachable.variant :thumb, resize: "100x100"
|
417
|
-
attachable.variant :medium, resize: "300x300", monochrome: true
|
418
|
-
end
|
419
|
-
end
|
330
|
+
* Saving attachment(s) to a record returns the blob/blobs object
|
420
331
|
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
end
|
332
|
+
Previously, saving attachments did not return the blob/blobs that
|
333
|
+
were attached. Now, saving attachments to a record with `#attach`
|
334
|
+
method returns the blob or array of blobs that were attached to
|
335
|
+
the record. If it fails to save the attachment(s), then it returns
|
336
|
+
`false`.
|
427
337
|
|
428
|
-
|
429
|
-
```
|
338
|
+
*Ghouse Mohamed*
|
430
339
|
|
431
|
-
|
340
|
+
* Don't stream responses in redirect mode
|
432
341
|
|
433
|
-
|
434
|
-
|
342
|
+
Previously, both redirect mode and proxy mode streamed their
|
343
|
+
responses which caused a new thread to be created, and could end
|
344
|
+
up leaking connections in the connection pool. But since redirect
|
345
|
+
mode doesn't actually send any data, it doesn't need to be
|
346
|
+
streamed.
|
435
347
|
|
436
|
-
*
|
348
|
+
*Luke Lau*
|
437
349
|
|
438
|
-
*
|
439
|
-
improve fixture integration.
|
350
|
+
* Safe for direct upload on Libraries or Frameworks
|
440
351
|
|
441
|
-
|
352
|
+
Enable the use of custom headers during direct uploads, which allows for
|
353
|
+
the inclusion of Authorization bearer tokens or other forms of authorization
|
354
|
+
tokens through headers.
|
442
355
|
|
356
|
+
*Radamés Roriz*
|
443
357
|
|
444
|
-
Please check [
|
358
|
+
Please check [7-0-stable](https://github.com/rails/rails/blob/7-0-stable/activestorage/CHANGELOG.md) for previous changes.
|
data/MIT-LICENSE
CHANGED