activestorage 7.1.0.beta1 → 7.1.0.rc2
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 +26 -0
- data/README.md +2 -2
- 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 +1 -1
- data/app/models/active_storage/blob.rb +1 -1
- data/config/routes.rb +6 -4
- data/lib/active_storage/attached/changes/create_one.rb +31 -1
- data/lib/active_storage/gem_version.rb +1 -1
- 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: 2db4a90c319b444bda951a09f92ab841d1f66fc71c9314e06eedf76aa6d55d75
|
4
|
+
data.tar.gz: 1680dee6e7dd2d466f3153237064771859c331ec650ca06a94734a10e33e2694
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cf8ed1edf324f4c8242b415302359ac6b1890782fd1c1bb07648fde27642a4a782f71cf0df43d16602495afffe63f2a67cba19f3f6c9facc413153ceef0a54b5
|
7
|
+
data.tar.gz: d9fbe301e3dd02099c707adf0e00e1d8d688147e007f1fef51d178dd1eaf3b99a8c4220628200929afebe09d86b8c26f4fa429248231558ada977a9b420596c5
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,29 @@
|
|
1
|
+
## Rails 7.1.0.rc2 (October 01, 2023) ##
|
2
|
+
|
3
|
+
* No changes.
|
4
|
+
|
5
|
+
|
6
|
+
## Rails 7.1.0.rc1 (September 27, 2023) ##
|
7
|
+
|
8
|
+
* Add `expires_at` option to `ActiveStorage::Blob#signed_id`.
|
9
|
+
|
10
|
+
```ruby
|
11
|
+
rails_blob_path(user.avatar, disposition: "attachment", expires_at: 30.minutes.from_now)
|
12
|
+
<%= image_tag rails_blob_path(user.avatar.variant(resize: "100x100"), expires_at: 30.minutes.from_now) %>
|
13
|
+
```
|
14
|
+
|
15
|
+
*Aki*
|
16
|
+
|
17
|
+
* Allow attaching File and Pathname when assigning attributes, e.g.
|
18
|
+
|
19
|
+
```ruby
|
20
|
+
User.create!(avatar: File.open("image.jpg"))
|
21
|
+
User.create!(avatar: file_fixture("image.jpg"))
|
22
|
+
```
|
23
|
+
|
24
|
+
*Dorian Marié*
|
25
|
+
|
26
|
+
|
1
27
|
## Rails 7.1.0.beta1 (September 13, 2023) ##
|
2
28
|
|
3
29
|
* Disables the session in `ActiveStorage::Blobs::ProxyController`
|
data/README.md
CHANGED
@@ -145,7 +145,7 @@ Active Storage, with its included JavaScript library, supports uploading directl
|
|
145
145
|
1. Include the Active Storage JavaScript in your application's JavaScript bundle or reference it directly.
|
146
146
|
|
147
147
|
Requiring directly without bundling through the asset pipeline in the application HTML with autostart:
|
148
|
-
```
|
148
|
+
```erb
|
149
149
|
<%= javascript_include_tag "activestorage" %>
|
150
150
|
```
|
151
151
|
Requiring via importmap-rails without bundling through the asset pipeline in the application HTML without autostart as ESM:
|
@@ -170,7 +170,7 @@ Active Storage, with its included JavaScript library, supports uploading directl
|
|
170
170
|
```
|
171
171
|
2. Annotate file inputs with the direct upload URL.
|
172
172
|
|
173
|
-
```
|
173
|
+
```erb
|
174
174
|
<%= form.file_field :attachments, multiple: true, direct_upload: true %>
|
175
175
|
```
|
176
176
|
3. That's it! Uploads begin upon form submission.
|
@@ -5,7 +5,7 @@ class ActiveStorage::AnalyzeJob < ActiveStorage::BaseJob
|
|
5
5
|
queue_as { ActiveStorage.queues[:analysis] }
|
6
6
|
|
7
7
|
discard_on ActiveRecord::RecordNotFound
|
8
|
-
retry_on ActiveStorage::IntegrityError, attempts: 10, wait: :
|
8
|
+
retry_on ActiveStorage::IntegrityError, attempts: 10, wait: :polynomially_longer
|
9
9
|
|
10
10
|
def perform(blob)
|
11
11
|
blob.analyze
|
@@ -7,7 +7,7 @@ class ActiveStorage::MirrorJob < ActiveStorage::BaseJob
|
|
7
7
|
queue_as { ActiveStorage.queues[:mirror] }
|
8
8
|
|
9
9
|
discard_on ActiveStorage::FileNotFoundError
|
10
|
-
retry_on ActiveStorage::IntegrityError, attempts: 10, wait: :
|
10
|
+
retry_on ActiveStorage::IntegrityError, attempts: 10, wait: :polynomially_longer
|
11
11
|
|
12
12
|
def perform(key, checksum:)
|
13
13
|
ActiveStorage::Blob.service.try(:mirror, key, checksum: checksum)
|
@@ -5,7 +5,7 @@ class ActiveStorage::PurgeJob < ActiveStorage::BaseJob
|
|
5
5
|
queue_as { ActiveStorage.queues[:purge] }
|
6
6
|
|
7
7
|
discard_on ActiveRecord::RecordNotFound
|
8
|
-
retry_on ActiveRecord::Deadlocked, attempts: 10, wait: :
|
8
|
+
retry_on ActiveRecord::Deadlocked, attempts: 10, wait: :polynomially_longer
|
9
9
|
|
10
10
|
def perform(blob)
|
11
11
|
blob.purge
|
@@ -4,7 +4,7 @@ class ActiveStorage::TransformJob < ActiveStorage::BaseJob
|
|
4
4
|
queue_as { ActiveStorage.queues[:transform] }
|
5
5
|
|
6
6
|
discard_on ActiveRecord::RecordNotFound
|
7
|
-
retry_on ActiveStorage::IntegrityError, attempts: 10, wait: :
|
7
|
+
retry_on ActiveStorage::IntegrityError, attempts: 10, wait: :polynomially_longer
|
8
8
|
|
9
9
|
def perform(blob, transformations)
|
10
10
|
blob.variant(transformations).processed
|
@@ -158,7 +158,7 @@ class ActiveStorage::Blob < ActiveStorage::Record
|
|
158
158
|
end
|
159
159
|
|
160
160
|
# Returns a signed ID for this blob that's suitable for reference on the client-side without fear of tampering.
|
161
|
-
def signed_id(purpose: :blob_id, expires_in: nil)
|
161
|
+
def signed_id(purpose: :blob_id, expires_in: nil, expires_at: nil)
|
162
162
|
super
|
163
163
|
end
|
164
164
|
|
data/config/routes.rb
CHANGED
@@ -32,16 +32,17 @@ Rails.application.routes.draw do
|
|
32
32
|
|
33
33
|
direct :rails_storage_proxy do |model, options|
|
34
34
|
expires_in = options.delete(:expires_in) { ActiveStorage.urls_expire_in }
|
35
|
+
expires_at = options.delete(:expires_at)
|
35
36
|
|
36
37
|
if model.respond_to?(:signed_id)
|
37
38
|
route_for(
|
38
39
|
:rails_service_blob_proxy,
|
39
|
-
model.signed_id(expires_in: expires_in),
|
40
|
+
model.signed_id(expires_in: expires_in, expires_at: expires_at),
|
40
41
|
model.filename,
|
41
42
|
options
|
42
43
|
)
|
43
44
|
else
|
44
|
-
signed_blob_id = model.blob.signed_id(expires_in: expires_in)
|
45
|
+
signed_blob_id = model.blob.signed_id(expires_in: expires_in, expires_at: expires_at)
|
45
46
|
variation_key = model.variation.key
|
46
47
|
filename = model.blob.filename
|
47
48
|
|
@@ -57,16 +58,17 @@ Rails.application.routes.draw do
|
|
57
58
|
|
58
59
|
direct :rails_storage_redirect do |model, options|
|
59
60
|
expires_in = options.delete(:expires_in) { ActiveStorage.urls_expire_in }
|
61
|
+
expires_at = options.delete(:expires_at)
|
60
62
|
|
61
63
|
if model.respond_to?(:signed_id)
|
62
64
|
route_for(
|
63
65
|
:rails_service_blob,
|
64
|
-
model.signed_id(expires_in: expires_in),
|
66
|
+
model.signed_id(expires_in: expires_in, expires_at: expires_at),
|
65
67
|
model.filename,
|
66
68
|
options
|
67
69
|
)
|
68
70
|
else
|
69
|
-
signed_blob_id = model.blob.signed_id(expires_in: expires_in)
|
71
|
+
signed_blob_id = model.blob.signed_id(expires_in: expires_in, expires_at: expires_at)
|
70
72
|
variation_key = model.variation.key
|
71
73
|
filename = model.blob.filename
|
72
74
|
|
@@ -30,6 +30,18 @@ module ActiveStorage
|
|
30
30
|
)
|
31
31
|
when Hash
|
32
32
|
blob.upload_without_unfurling(attachable.fetch(:io))
|
33
|
+
when File
|
34
|
+
blob.upload_without_unfurling(attachable)
|
35
|
+
when Pathname
|
36
|
+
blob.upload_without_unfurling(attachable.open)
|
37
|
+
when ActiveStorage::Blob
|
38
|
+
when String
|
39
|
+
else
|
40
|
+
raise(
|
41
|
+
ArgumentError,
|
42
|
+
"Could not upload: expected attachable, " \
|
43
|
+
"got #{attachable.inspect}"
|
44
|
+
)
|
33
45
|
end
|
34
46
|
end
|
35
47
|
|
@@ -82,8 +94,26 @@ module ActiveStorage
|
|
82
94
|
)
|
83
95
|
when String
|
84
96
|
ActiveStorage::Blob.find_signed!(attachable, record: record)
|
97
|
+
when File
|
98
|
+
ActiveStorage::Blob.build_after_unfurling(
|
99
|
+
io: attachable,
|
100
|
+
filename: File.basename(attachable),
|
101
|
+
record: record,
|
102
|
+
service_name: attachment_service_name
|
103
|
+
)
|
104
|
+
when Pathname
|
105
|
+
ActiveStorage::Blob.build_after_unfurling(
|
106
|
+
io: attachable.open,
|
107
|
+
filename: File.basename(attachable),
|
108
|
+
record: record,
|
109
|
+
service_name: attachment_service_name
|
110
|
+
)
|
85
111
|
else
|
86
|
-
raise
|
112
|
+
raise(
|
113
|
+
ArgumentError,
|
114
|
+
"Could not find or build blob: expected attachable, " \
|
115
|
+
"got #{attachable.inspect}"
|
116
|
+
)
|
87
117
|
end
|
88
118
|
end
|
89
119
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activestorage
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 7.1.0.
|
4
|
+
version: 7.1.0.rc2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Heinemeier Hansson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-10-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -16,56 +16,56 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 7.1.0.
|
19
|
+
version: 7.1.0.rc2
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 7.1.0.
|
26
|
+
version: 7.1.0.rc2
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: actionpack
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - '='
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 7.1.0.
|
33
|
+
version: 7.1.0.rc2
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - '='
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 7.1.0.
|
40
|
+
version: 7.1.0.rc2
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: activejob
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - '='
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 7.1.0.
|
47
|
+
version: 7.1.0.rc2
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - '='
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 7.1.0.
|
54
|
+
version: 7.1.0.rc2
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: activerecord
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - '='
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 7.1.0.
|
61
|
+
version: 7.1.0.rc2
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - '='
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 7.1.0.
|
68
|
+
version: 7.1.0.rc2
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: marcel
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -188,10 +188,10 @@ licenses:
|
|
188
188
|
- MIT
|
189
189
|
metadata:
|
190
190
|
bug_tracker_uri: https://github.com/rails/rails/issues
|
191
|
-
changelog_uri: https://github.com/rails/rails/blob/v7.1.0.
|
192
|
-
documentation_uri: https://api.rubyonrails.org/v7.1.0.
|
191
|
+
changelog_uri: https://github.com/rails/rails/blob/v7.1.0.rc2/activestorage/CHANGELOG.md
|
192
|
+
documentation_uri: https://api.rubyonrails.org/v7.1.0.rc2/
|
193
193
|
mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
|
194
|
-
source_code_uri: https://github.com/rails/rails/tree/v7.1.0.
|
194
|
+
source_code_uri: https://github.com/rails/rails/tree/v7.1.0.rc2/activestorage
|
195
195
|
rubygems_mfa_required: 'true'
|
196
196
|
post_install_message:
|
197
197
|
rdoc_options: []
|