activestorage 7.2.3 → 8.0.4
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 +37 -81
- data/README.md +2 -2
- data/app/assets/javascripts/activestorage.esm.js +1 -1
- data/app/assets/javascripts/activestorage.js +1 -0
- data/app/controllers/active_storage/direct_uploads_controller.rb +1 -1
- data/app/controllers/concerns/active_storage/streaming.rb +9 -0
- data/app/javascript/activestorage/index.js +2 -1
- data/app/models/active_storage/blob/representable.rb +5 -5
- data/app/models/active_storage/blob.rb +2 -3
- data/app/models/active_storage/filename.rb +1 -1
- data/app/models/active_storage/variant.rb +6 -6
- data/lib/active_storage/analyzer/image_analyzer/vips.rb +1 -1
- data/lib/active_storage/attached/model.rb +20 -16
- data/lib/active_storage/gem_version.rb +3 -3
- data/lib/active_storage/service/azure_storage_service.rb +7 -0
- data/lib/active_storage/service/mirror_service.rb +12 -3
- metadata +13 -13
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ce359384edcd544a06487eeb0833a4679b8bf2e1c91a3e799564d913a6f091ed
|
|
4
|
+
data.tar.gz: 529886878aaf1970f1a9ad34f1e82619590cd700764fbf4b95752ad377b20917
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1d9614ae20008c7aa8c1b6f673611c51d2fb17deb2fc51661fbc0f545eaa90818c4b4800ec48d96da5d0d9fd9efe88260dacece34bcf32ae0295371e63a2f12b
|
|
7
|
+
data.tar.gz: 552a60fcf15cc57881e00e2c2604046151e67c3dac94c66889c476aa79fe85f7a385291a4b3a7cdf37e22a0b21a8d687956ea855c3f0afbd5f8731ec45534204
|
data/CHANGELOG.md
CHANGED
|
@@ -1,23 +1,20 @@
|
|
|
1
|
-
## Rails
|
|
1
|
+
## Rails 8.0.4 (October 28, 2025) ##
|
|
2
2
|
|
|
3
|
-
*
|
|
3
|
+
* No changes.
|
|
4
4
|
|
|
5
|
-
*fatkodima*
|
|
6
5
|
|
|
7
|
-
|
|
6
|
+
## Rails 8.0.3 (September 22, 2025) ##
|
|
8
7
|
|
|
9
|
-
|
|
10
|
-
its dirty attributes reset, preventing your `after commit` callbacks
|
|
11
|
-
on that record to behave as expected.
|
|
8
|
+
* Address deprecation of `Aws::S3::Object#upload_stream` in `ActiveStorage::Service::S3Service`.
|
|
12
9
|
|
|
13
|
-
|
|
14
|
-
and is supposed to be internal. Active Storage Attachment will continue
|
|
15
|
-
to be autosaved (through a different relation).
|
|
10
|
+
*Joshua Young*
|
|
16
11
|
|
|
17
|
-
|
|
12
|
+
* Fix `config.active_storage.touch_attachment_records` to work with eager loading.
|
|
13
|
+
|
|
14
|
+
*fatkodima*
|
|
18
15
|
|
|
19
16
|
|
|
20
|
-
## Rails
|
|
17
|
+
## Rails 8.0.2.1 (August 13, 2025) ##
|
|
21
18
|
|
|
22
19
|
* Remove dangerous transformations
|
|
23
20
|
|
|
@@ -25,107 +22,66 @@
|
|
|
25
22
|
|
|
26
23
|
*Zack Deveau*
|
|
27
24
|
|
|
25
|
+
## Rails 8.0.2 (March 12, 2025) ##
|
|
28
26
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
* No changes.
|
|
27
|
+
* A Blob will no longer autosave associated Attachment.
|
|
32
28
|
|
|
29
|
+
This fixes an issue where a record with an attachment would have
|
|
30
|
+
its dirty attributes reset, preventing your `after commit` callbacks
|
|
31
|
+
on that record to behave as expected.
|
|
33
32
|
|
|
34
|
-
|
|
33
|
+
Note that this change doesn't require any changes on your application
|
|
34
|
+
and is supposed to be internal. Active Storage Attachment will continue
|
|
35
|
+
to be autosaved (through a different relation).
|
|
35
36
|
|
|
36
|
-
*
|
|
37
|
+
*Edouard-chin*
|
|
37
38
|
|
|
38
39
|
|
|
39
|
-
## Rails
|
|
40
|
+
## Rails 8.0.1 (December 13, 2024) ##
|
|
40
41
|
|
|
41
42
|
* No changes.
|
|
42
43
|
|
|
43
44
|
|
|
44
|
-
## Rails
|
|
45
|
+
## Rails 8.0.0.1 (December 10, 2024) ##
|
|
45
46
|
|
|
46
47
|
* No changes.
|
|
47
48
|
|
|
48
49
|
|
|
49
|
-
## Rails
|
|
50
|
+
## Rails 8.0.0 (November 07, 2024) ##
|
|
50
51
|
|
|
51
52
|
* No changes.
|
|
52
53
|
|
|
53
54
|
|
|
54
|
-
## Rails
|
|
55
|
-
|
|
56
|
-
* Remove deprecated `config.active_storage.silence_invalid_content_types_warning`.
|
|
57
|
-
|
|
58
|
-
*Rafael Mendonça França*
|
|
59
|
-
|
|
60
|
-
* Remove deprecated `config.active_storage.replace_on_assign_to_many`.
|
|
61
|
-
|
|
62
|
-
*Rafael Mendonça França*
|
|
63
|
-
|
|
64
|
-
* Add support for custom `key` in `ActiveStorage::Blob#compose`.
|
|
65
|
-
|
|
66
|
-
*Elvin Efendiev*
|
|
67
|
-
|
|
68
|
-
* Add `image/webp` to `config.active_storage.web_image_content_types` when `load_defaults "7.2"`
|
|
69
|
-
is set.
|
|
70
|
-
|
|
71
|
-
*Lewis Buckley*
|
|
55
|
+
## Rails 8.0.0.rc2 (October 30, 2024) ##
|
|
72
56
|
|
|
73
|
-
*
|
|
74
|
-
|
|
75
|
-
*Jonathan del Strother*
|
|
76
|
-
|
|
77
|
-
* Fix N+1 query when fetching preview images for non-image assets.
|
|
78
|
-
|
|
79
|
-
*Aaron Patterson & Justin Searls*
|
|
80
|
-
|
|
81
|
-
* Fix all Active Storage database related models to respect
|
|
82
|
-
`ActiveRecord::Base.table_name_prefix` configuration.
|
|
83
|
-
|
|
84
|
-
*Chedli Bourguiba*
|
|
85
|
-
|
|
86
|
-
* Fix `ActiveStorage::Representations::ProxyController` not returning the proper
|
|
87
|
-
preview image variant for previewable files.
|
|
88
|
-
|
|
89
|
-
*Chedli Bourguiba*
|
|
90
|
-
|
|
91
|
-
* Fix `ActiveStorage::Representations::ProxyController` to proxy untracked
|
|
92
|
-
variants.
|
|
57
|
+
* No changes.
|
|
93
58
|
|
|
94
|
-
*Chedli Bourguiba*
|
|
95
59
|
|
|
96
|
-
|
|
97
|
-
for blobs that are not representable.
|
|
60
|
+
## Rails 8.0.0.rc1 (October 19, 2024) ##
|
|
98
61
|
|
|
99
|
-
|
|
62
|
+
* No changes.
|
|
100
63
|
|
|
101
|
-
* Prevent `ActiveStorage::Blob#preview` to generate a variant if an empty variation is passed.
|
|
102
64
|
|
|
103
|
-
|
|
104
|
-
image instead of generating a variant with the exact same dimensions.
|
|
65
|
+
## Rails 8.0.0.beta1 (September 26, 2024) ##
|
|
105
66
|
|
|
106
|
-
|
|
67
|
+
* Deprecate `ActiveStorage::Service::AzureStorageService`.
|
|
107
68
|
|
|
108
|
-
*
|
|
69
|
+
*zzak*
|
|
109
70
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
Previously, the `:thumb` variant would not be generated until a further call
|
|
113
|
-
to e.g. `processed.url`.
|
|
71
|
+
* Improve `ActiveStorage::Filename#sanitized` method to handle special characters more effectively.
|
|
72
|
+
Replace the characters `"*?<>` with `-` if they exist in the Filename to match the Filename convention of Win OS.
|
|
114
73
|
|
|
115
|
-
*
|
|
74
|
+
*Luong Viet Dung(Martin)*
|
|
116
75
|
|
|
117
|
-
*
|
|
118
|
-
enabled and the variant of an Active Storage preview has already been
|
|
119
|
-
processed (for example, by calling `ActiveStorage::Preview#url`).
|
|
76
|
+
* Improve InvariableError, UnpreviewableError and UnrepresentableError message.
|
|
120
77
|
|
|
121
|
-
|
|
78
|
+
Include Blob ID and content_type in the messages.
|
|
122
79
|
|
|
123
|
-
*
|
|
80
|
+
*Petrik de Heus*
|
|
124
81
|
|
|
125
|
-
|
|
82
|
+
* Mark proxied files as `immutable` in their Cache-Control header
|
|
126
83
|
|
|
127
|
-
*
|
|
84
|
+
*Nate Matykiewicz*
|
|
128
85
|
|
|
129
|
-
*Yogesh Khater*
|
|
130
86
|
|
|
131
|
-
Please check [7-
|
|
87
|
+
Please check [7-2-stable](https://github.com/rails/rails/blob/7-2-stable/activestorage/CHANGELOG.md) for previous changes.
|
data/README.md
CHANGED
|
@@ -73,7 +73,7 @@ end
|
|
|
73
73
|
```erb
|
|
74
74
|
<%= form_with model: @message, local: true do |form| %>
|
|
75
75
|
<%= form.text_field :title, placeholder: "Title" %><br>
|
|
76
|
-
<%= form.
|
|
76
|
+
<%= form.textarea :content %><br><br>
|
|
77
77
|
|
|
78
78
|
<%= form.file_field :images, multiple: true %><br>
|
|
79
79
|
<%= form.submit %>
|
|
@@ -88,7 +88,7 @@ class MessagesController < ApplicationController
|
|
|
88
88
|
end
|
|
89
89
|
|
|
90
90
|
def create
|
|
91
|
-
message = Message.create! params.
|
|
91
|
+
message = Message.create! params.expect(message: [ :title, :content, images: [] ])
|
|
92
92
|
redirect_to message
|
|
93
93
|
end
|
|
94
94
|
|
|
@@ -822,6 +822,7 @@
|
|
|
822
822
|
exports.DirectUpload = DirectUpload;
|
|
823
823
|
exports.DirectUploadController = DirectUploadController;
|
|
824
824
|
exports.DirectUploadsController = DirectUploadsController;
|
|
825
|
+
exports.dispatchEvent = dispatchEvent;
|
|
825
826
|
exports.start = start;
|
|
826
827
|
Object.defineProperty(exports, "__esModule", {
|
|
827
828
|
value: true
|
|
@@ -11,7 +11,7 @@ class ActiveStorage::DirectUploadsController < ActiveStorage::BaseController
|
|
|
11
11
|
|
|
12
12
|
private
|
|
13
13
|
def blob_args
|
|
14
|
-
params.
|
|
14
|
+
params.expect(blob: [:filename, :byte_size, :checksum, :content_type, metadata: {}]).to_h.symbolize_keys
|
|
15
15
|
end
|
|
16
16
|
|
|
17
17
|
def direct_upload_json(blob)
|
|
@@ -61,6 +61,15 @@ module ActiveStorage::Streaming
|
|
|
61
61
|
blob.download do |chunk|
|
|
62
62
|
stream.write chunk
|
|
63
63
|
end
|
|
64
|
+
rescue ActiveStorage::FileNotFoundError
|
|
65
|
+
expires_now
|
|
66
|
+
head :not_found
|
|
67
|
+
rescue
|
|
68
|
+
# Status and caching headers are already set, but not committed.
|
|
69
|
+
# Change the status to 500 manually.
|
|
70
|
+
expires_now
|
|
71
|
+
head :internal_server_error
|
|
72
|
+
raise
|
|
64
73
|
end
|
|
65
74
|
end
|
|
66
75
|
end
|
|
@@ -2,7 +2,8 @@ import { start } from "./ujs"
|
|
|
2
2
|
import { DirectUpload } from "./direct_upload"
|
|
3
3
|
import { DirectUploadController } from "./direct_upload_controller"
|
|
4
4
|
import { DirectUploadsController } from "./direct_uploads_controller"
|
|
5
|
-
|
|
5
|
+
import { dispatchEvent } from "./helpers"
|
|
6
|
+
export { start, DirectUpload, DirectUploadController, DirectUploadsController, dispatchEvent }
|
|
6
7
|
|
|
7
8
|
function autostart() {
|
|
8
9
|
if (window.ActiveStorage) {
|
|
@@ -25,8 +25,8 @@ module ActiveStorage::Blob::Representable
|
|
|
25
25
|
#
|
|
26
26
|
# <%= image_tag Current.user.avatar.variant(resize_to_limit: [100, 100]) %>
|
|
27
27
|
#
|
|
28
|
-
# This will create a URL for that specific blob with that specific variant, which the ActiveStorage::
|
|
29
|
-
# can then produce on-demand.
|
|
28
|
+
# This will create a URL for that specific blob with that specific variant, which the ActiveStorage::Representations::ProxyController
|
|
29
|
+
# or ActiveStorage::Representations::RedirectController can then produce on-demand.
|
|
30
30
|
#
|
|
31
31
|
# Raises ActiveStorage::InvariableError if the variant processor cannot
|
|
32
32
|
# transform the blob. To determine whether a blob is variable, call
|
|
@@ -101,7 +101,7 @@ module ActiveStorage::Blob::Representable
|
|
|
101
101
|
if variable?
|
|
102
102
|
variant_class.new(self, ActiveStorage::Variation.wrap(transformations).default_to(default_variant_transformations))
|
|
103
103
|
else
|
|
104
|
-
raise ActiveStorage::InvariableError
|
|
104
|
+
raise ActiveStorage::InvariableError, "Can't transform blob with ID=#{id} and content_type=#{content_type}"
|
|
105
105
|
end
|
|
106
106
|
end
|
|
107
107
|
|
|
@@ -130,7 +130,7 @@ module ActiveStorage::Blob::Representable
|
|
|
130
130
|
if previewable?
|
|
131
131
|
ActiveStorage::Preview.new(self, transformations)
|
|
132
132
|
else
|
|
133
|
-
raise ActiveStorage::UnpreviewableError
|
|
133
|
+
raise ActiveStorage::UnpreviewableError, "No previewer found for blob with ID=#{id} and content_type=#{content_type}"
|
|
134
134
|
end
|
|
135
135
|
end
|
|
136
136
|
|
|
@@ -155,7 +155,7 @@ module ActiveStorage::Blob::Representable
|
|
|
155
155
|
when variable?
|
|
156
156
|
variant transformations
|
|
157
157
|
else
|
|
158
|
-
raise ActiveStorage::UnrepresentableError
|
|
158
|
+
raise ActiveStorage::UnrepresentableError, "No previewer found and can't transform blob with ID=#{id} and content_type=#{content_type}"
|
|
159
159
|
end
|
|
160
160
|
end
|
|
161
161
|
|
|
@@ -71,9 +71,8 @@ class ActiveStorage::Blob < ActiveStorage::Record
|
|
|
71
71
|
end
|
|
72
72
|
|
|
73
73
|
# Works like +find_signed+, but will raise an +ActiveSupport::MessageVerifier::InvalidSignature+
|
|
74
|
-
# exception if the +signed_id+ has either expired, has a purpose mismatch,
|
|
75
|
-
#
|
|
76
|
-
# the valid signed id can't find a record.
|
|
74
|
+
# exception if the +signed_id+ has either expired, has a purpose mismatch, or has been tampered with.
|
|
75
|
+
# It will also raise an +ActiveRecord::RecordNotFound+ exception if the valid signed id can't find a record.
|
|
77
76
|
def find_signed!(id, record: nil, purpose: :blob_id)
|
|
78
77
|
super(id, purpose: purpose)
|
|
79
78
|
end
|
|
@@ -57,7 +57,7 @@ class ActiveStorage::Filename
|
|
|
57
57
|
#
|
|
58
58
|
# Characters considered unsafe for storage (e.g. \, $, and the RTL override character) are replaced with a dash.
|
|
59
59
|
def sanitized
|
|
60
|
-
@filename.encode(Encoding::UTF_8, invalid: :replace, undef: :replace, replace: "�").strip.tr("\u{202E}
|
|
60
|
+
@filename.encode(Encoding::UTF_8, invalid: :replace, undef: :replace, replace: "�").strip.tr("\u{202E}%$|:;/<>?*\"\t\r\n\\", "-")
|
|
61
61
|
end
|
|
62
62
|
|
|
63
63
|
# Returns the sanitized version of the filename.
|
|
@@ -22,15 +22,15 @@
|
|
|
22
22
|
# Note that to create a variant it's necessary to download the entire blob file from the service. Because of this process,
|
|
23
23
|
# you also want to be considerate about when the variant is actually processed. You shouldn't be processing variants inline
|
|
24
24
|
# in a template, for example. Delay the processing to an on-demand controller, like the one provided in
|
|
25
|
-
# ActiveStorage::
|
|
25
|
+
# ActiveStorage::Representations::ProxyController and ActiveStorage::Representations::RedirectController.
|
|
26
26
|
#
|
|
27
27
|
# To refer to such a delayed on-demand variant, simply link to the variant through the resolved route provided
|
|
28
28
|
# by Active Storage like so:
|
|
29
29
|
#
|
|
30
30
|
# <%= image_tag Current.user.avatar.variant(resize_to_limit: [100, 100]) %>
|
|
31
31
|
#
|
|
32
|
-
# This will create a URL for that specific blob with that specific variant, which the ActiveStorage::
|
|
33
|
-
# can then produce on-demand.
|
|
32
|
+
# This will create a URL for that specific blob with that specific variant, which the ActiveStorage::Representations::ProxyController
|
|
33
|
+
# or ActiveStorage::Representations::RedirectController can then produce on-demand.
|
|
34
34
|
#
|
|
35
35
|
# When you do want to actually produce the variant needed, call +processed+. This will check that the variant
|
|
36
36
|
# has already been processed and uploaded to the service, and, if so, just return that. Otherwise it will perform
|
|
@@ -74,11 +74,11 @@ class ActiveStorage::Variant
|
|
|
74
74
|
"variants/#{blob.key}/#{OpenSSL::Digest::SHA256.hexdigest(variation.key)}"
|
|
75
75
|
end
|
|
76
76
|
|
|
77
|
-
# Returns the URL of the blob variant on the service. See
|
|
77
|
+
# Returns the URL of the blob variant on the service. See ActiveStorage::Blob#url for details.
|
|
78
78
|
#
|
|
79
79
|
# Use <tt>url_for(variant)</tt> (or the implied form, like <tt>link_to variant</tt> or <tt>redirect_to variant</tt>) to get the stable URL
|
|
80
|
-
# for a variant that points to the ActiveStorage::
|
|
81
|
-
# for its redirection.
|
|
80
|
+
# for a variant that points to the ActiveStorage::Representations::ProxyController or ActiveStorage::Representations::RedirectController,
|
|
81
|
+
# which in turn will use this +service_call+ method for its redirection.
|
|
82
82
|
def url(expires_in: ActiveStorage.service_urls_expire_in, disposition: :inline)
|
|
83
83
|
service.url key, expires_in: expires_in, disposition: disposition, filename: filename, content_type: content_type
|
|
84
84
|
end
|
|
@@ -61,18 +61,16 @@ module ActiveStorage
|
|
|
61
61
|
# There is no column defined on the model side, Active Storage takes
|
|
62
62
|
# care of the mapping between your records and the attachment.
|
|
63
63
|
#
|
|
64
|
-
#
|
|
65
|
-
#
|
|
66
|
-
# User.with_attached_avatar
|
|
67
|
-
#
|
|
68
|
-
# Under the covers, this relationship is implemented as a +has_one+ association to a
|
|
69
|
-
# ActiveStorage::Attachment record and a +has_one-through+ association to a
|
|
64
|
+
# Under the covers, this relationship is implemented as a +has_one+ association to an
|
|
65
|
+
# ActiveStorage::Attachment record and a +has_one-through+ association to an
|
|
70
66
|
# ActiveStorage::Blob record. These associations are available as +avatar_attachment+
|
|
71
67
|
# and +avatar_blob+. But you shouldn't need to work with these associations directly in
|
|
72
68
|
# most circumstances.
|
|
73
69
|
#
|
|
74
|
-
#
|
|
75
|
-
#
|
|
70
|
+
# Instead, +has_one_attached+ generates an ActiveStorage::Attached::One proxy to
|
|
71
|
+
# provide access to the associations and factory methods, like +attach+:
|
|
72
|
+
#
|
|
73
|
+
# user.avatar.attach(uploaded_file)
|
|
76
74
|
#
|
|
77
75
|
# The +:dependent+ option defaults to +:purge_later+. This means the attachment will be
|
|
78
76
|
# purged (i.e. destroyed) in the background whenever the record is destroyed.
|
|
@@ -92,6 +90,10 @@ module ActiveStorage
|
|
|
92
90
|
# has_one_attached :avatar, service: ->(user) { user.in_europe_region? ? :s3_europe : :s3_usa }
|
|
93
91
|
# end
|
|
94
92
|
#
|
|
93
|
+
# To avoid N+1 queries, you can include the attached blobs in your query like so:
|
|
94
|
+
#
|
|
95
|
+
# User.with_attached_avatar
|
|
96
|
+
#
|
|
95
97
|
# If you need to enable +strict_loading+ to prevent lazy loading of attachment,
|
|
96
98
|
# pass the +:strict_loading+ option. You can do:
|
|
97
99
|
#
|
|
@@ -161,18 +163,16 @@ module ActiveStorage
|
|
|
161
163
|
# There are no columns defined on the model side, Active Storage takes
|
|
162
164
|
# care of the mapping between your records and the attachments.
|
|
163
165
|
#
|
|
164
|
-
#
|
|
165
|
-
#
|
|
166
|
-
# Gallery.where(user: Current.user).with_attached_photos
|
|
167
|
-
#
|
|
168
|
-
# Under the covers, this relationship is implemented as a +has_many+ association to a
|
|
169
|
-
# ActiveStorage::Attachment record and a +has_many-through+ association to a
|
|
166
|
+
# Under the covers, this relationship is implemented as a +has_many+ association to an
|
|
167
|
+
# ActiveStorage::Attachment record and a +has_many-through+ association to an
|
|
170
168
|
# ActiveStorage::Blob record. These associations are available as +photos_attachments+
|
|
171
169
|
# and +photos_blobs+. But you shouldn't need to work with these associations directly in
|
|
172
170
|
# most circumstances.
|
|
173
171
|
#
|
|
174
|
-
#
|
|
175
|
-
#
|
|
172
|
+
# Instead, +has_many_attached+ generates an ActiveStorage::Attached::Many proxy to
|
|
173
|
+
# provide access to the associations and factory methods, like +attach+:
|
|
174
|
+
#
|
|
175
|
+
# user.photos.attach(uploaded_file)
|
|
176
176
|
#
|
|
177
177
|
# The +:dependent+ option defaults to +:purge_later+. This means the attachments will be
|
|
178
178
|
# purged (i.e. destroyed) in the background whenever the record is destroyed.
|
|
@@ -192,6 +192,10 @@ module ActiveStorage
|
|
|
192
192
|
# has_many_attached :photos, service: ->(gallery) { gallery.personal? ? :personal_s3 : :s3 }
|
|
193
193
|
# end
|
|
194
194
|
#
|
|
195
|
+
# To avoid N+1 queries, you can include the attached blobs in your query like so:
|
|
196
|
+
#
|
|
197
|
+
# Gallery.where(user: Current.user).with_attached_photos
|
|
198
|
+
#
|
|
195
199
|
# If you need to enable +strict_loading+ to prevent lazy loading of attachments,
|
|
196
200
|
# pass the +:strict_loading+ option. You can do:
|
|
197
201
|
#
|
|
@@ -15,6 +15,13 @@ module ActiveStorage
|
|
|
15
15
|
attr_reader :client, :container, :signer
|
|
16
16
|
|
|
17
17
|
def initialize(storage_account_name:, storage_access_key:, container:, public: false, **options)
|
|
18
|
+
ActiveStorage.deprecator.warn <<~MSG.squish
|
|
19
|
+
`ActiveStorage::Service::AzureStorageService` is deprecated and will be
|
|
20
|
+
removed in Rails 8.1.
|
|
21
|
+
Please try the `azure-blob` gem instead.
|
|
22
|
+
This gem is not maintained by the Rails team, so please test your applications before deploying to production.
|
|
23
|
+
MSG
|
|
24
|
+
|
|
18
25
|
@client = Azure::Storage::Blob::BlobService.create(storage_account_name: storage_account_name, storage_access_key: storage_access_key, **options)
|
|
19
26
|
@signer = Azure::Storage::Common::Core::Auth::SharedAccessSignature.new(storage_account_name, storage_access_key)
|
|
20
27
|
@container = container
|
|
@@ -30,6 +30,13 @@ module ActiveStorage
|
|
|
30
30
|
|
|
31
31
|
def initialize(primary:, mirrors:)
|
|
32
32
|
@primary, @mirrors = primary, mirrors
|
|
33
|
+
@executor = Concurrent::ThreadPoolExecutor.new(
|
|
34
|
+
min_threads: 1,
|
|
35
|
+
max_threads: mirrors.size,
|
|
36
|
+
max_queue: 0,
|
|
37
|
+
fallback_policy: :caller_runs,
|
|
38
|
+
idle_time: 60
|
|
39
|
+
)
|
|
33
40
|
end
|
|
34
41
|
|
|
35
42
|
# Upload the +io+ to the +key+ specified to all services. The upload to the primary service is done synchronously
|
|
@@ -75,10 +82,12 @@ module ActiveStorage
|
|
|
75
82
|
end
|
|
76
83
|
|
|
77
84
|
def perform_across_services(method, *args)
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
85
|
+
tasks = each_service.collect do |service|
|
|
86
|
+
Concurrent::Promise.execute(executor: @executor) do
|
|
87
|
+
service.public_send method, *args
|
|
88
|
+
end
|
|
81
89
|
end
|
|
90
|
+
tasks.each(&:value!)
|
|
82
91
|
end
|
|
83
92
|
end
|
|
84
93
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: activestorage
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 8.0.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- David Heinemeier Hansson
|
|
@@ -15,56 +15,56 @@ dependencies:
|
|
|
15
15
|
requirements:
|
|
16
16
|
- - '='
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
|
-
version:
|
|
18
|
+
version: 8.0.4
|
|
19
19
|
type: :runtime
|
|
20
20
|
prerelease: false
|
|
21
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
22
22
|
requirements:
|
|
23
23
|
- - '='
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
|
-
version:
|
|
25
|
+
version: 8.0.4
|
|
26
26
|
- !ruby/object:Gem::Dependency
|
|
27
27
|
name: actionpack
|
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|
|
29
29
|
requirements:
|
|
30
30
|
- - '='
|
|
31
31
|
- !ruby/object:Gem::Version
|
|
32
|
-
version:
|
|
32
|
+
version: 8.0.4
|
|
33
33
|
type: :runtime
|
|
34
34
|
prerelease: false
|
|
35
35
|
version_requirements: !ruby/object:Gem::Requirement
|
|
36
36
|
requirements:
|
|
37
37
|
- - '='
|
|
38
38
|
- !ruby/object:Gem::Version
|
|
39
|
-
version:
|
|
39
|
+
version: 8.0.4
|
|
40
40
|
- !ruby/object:Gem::Dependency
|
|
41
41
|
name: activejob
|
|
42
42
|
requirement: !ruby/object:Gem::Requirement
|
|
43
43
|
requirements:
|
|
44
44
|
- - '='
|
|
45
45
|
- !ruby/object:Gem::Version
|
|
46
|
-
version:
|
|
46
|
+
version: 8.0.4
|
|
47
47
|
type: :runtime
|
|
48
48
|
prerelease: false
|
|
49
49
|
version_requirements: !ruby/object:Gem::Requirement
|
|
50
50
|
requirements:
|
|
51
51
|
- - '='
|
|
52
52
|
- !ruby/object:Gem::Version
|
|
53
|
-
version:
|
|
53
|
+
version: 8.0.4
|
|
54
54
|
- !ruby/object:Gem::Dependency
|
|
55
55
|
name: activerecord
|
|
56
56
|
requirement: !ruby/object:Gem::Requirement
|
|
57
57
|
requirements:
|
|
58
58
|
- - '='
|
|
59
59
|
- !ruby/object:Gem::Version
|
|
60
|
-
version:
|
|
60
|
+
version: 8.0.4
|
|
61
61
|
type: :runtime
|
|
62
62
|
prerelease: false
|
|
63
63
|
version_requirements: !ruby/object:Gem::Requirement
|
|
64
64
|
requirements:
|
|
65
65
|
- - '='
|
|
66
66
|
- !ruby/object:Gem::Version
|
|
67
|
-
version:
|
|
67
|
+
version: 8.0.4
|
|
68
68
|
- !ruby/object:Gem::Dependency
|
|
69
69
|
name: marcel
|
|
70
70
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -189,10 +189,10 @@ licenses:
|
|
|
189
189
|
- MIT
|
|
190
190
|
metadata:
|
|
191
191
|
bug_tracker_uri: https://github.com/rails/rails/issues
|
|
192
|
-
changelog_uri: https://github.com/rails/rails/blob/
|
|
193
|
-
documentation_uri: https://api.rubyonrails.org/
|
|
192
|
+
changelog_uri: https://github.com/rails/rails/blob/v8.0.4/activestorage/CHANGELOG.md
|
|
193
|
+
documentation_uri: https://api.rubyonrails.org/v8.0.4/
|
|
194
194
|
mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
|
|
195
|
-
source_code_uri: https://github.com/rails/rails/tree/
|
|
195
|
+
source_code_uri: https://github.com/rails/rails/tree/v8.0.4/activestorage
|
|
196
196
|
rubygems_mfa_required: 'true'
|
|
197
197
|
rdoc_options: []
|
|
198
198
|
require_paths:
|
|
@@ -201,7 +201,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
201
201
|
requirements:
|
|
202
202
|
- - ">="
|
|
203
203
|
- !ruby/object:Gem::Version
|
|
204
|
-
version: 3.
|
|
204
|
+
version: 3.2.0
|
|
205
205
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
206
206
|
requirements:
|
|
207
207
|
- - ">="
|