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