activestorage 7.1.2 → 7.1.3.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +69 -0
- data/app/assets/javascripts/activestorage.esm.js +3 -3
- data/app/assets/javascripts/activestorage.js +3 -3
- data/app/controllers/active_storage/representations/proxy_controller.rb +1 -1
- data/app/javascript/activestorage/ujs.js +3 -3
- data/app/jobs/active_storage/transform_job.rb +2 -2
- data/app/models/active_storage/attachment.rb +4 -3
- data/app/models/active_storage/blob/representable.rb +1 -1
- data/app/models/active_storage/blob/servable.rb +22 -0
- data/app/models/active_storage/blob.rb +5 -21
- data/app/models/active_storage/preview.rb +6 -1
- data/app/models/active_storage/variant.rb +2 -0
- data/app/models/active_storage/variant_record.rb +0 -2
- data/app/models/active_storage/variant_with_record.rb +2 -0
- data/lib/active_storage/attached/model.rb +8 -2
- data/lib/active_storage/fixture_set.rb +4 -0
- data/lib/active_storage/gem_version.rb +2 -2
- metadata +15 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 10c31beefd192ae50216812e96dd7326c6d301f84f3a9ac4c42cf41369bfbd68
|
4
|
+
data.tar.gz: b744929e6b8cab0e2c2d2f834b453d538fad962a42b6b52f62ed74cf67fd000b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 93dcf40c82c8a7ecb7308c9e90c42a22816876cfe31c42304369a3979b4a6153a6296a8509d60a9e28bccdd0789f299ef3a734cb0b1b46ca1bd1cbd3c5f411ea
|
7
|
+
data.tar.gz: 56d0c210295b80a5bd0fa4145901652ddb3d1baede6a22993a294ae4031a378e99c45775e73caefa8890cf6a5bdafb224c215fc12ca33c20491a0cdf1b201b17
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,72 @@
|
|
1
|
+
## Rails 7.1.3.4 (June 04, 2024) ##
|
2
|
+
|
3
|
+
* No changes.
|
4
|
+
|
5
|
+
|
6
|
+
## Rails 7.1.3.3 (May 16, 2024) ##
|
7
|
+
|
8
|
+
* No changes.
|
9
|
+
|
10
|
+
|
11
|
+
## Rails 7.1.3.2 (February 21, 2024) ##
|
12
|
+
|
13
|
+
* No changes.
|
14
|
+
|
15
|
+
|
16
|
+
## Rails 7.1.3.1 (February 21, 2024) ##
|
17
|
+
|
18
|
+
* No changes.
|
19
|
+
|
20
|
+
|
21
|
+
## Rails 7.1.3 (January 16, 2024) ##
|
22
|
+
|
23
|
+
* Fix N+1 query when fetching preview images for non-image assets.
|
24
|
+
|
25
|
+
*Aaron Patterson & Justin Searls*
|
26
|
+
|
27
|
+
* Fix all Active Storage database related models to respect
|
28
|
+
`ActiveRecord::Base.table_name_prefix` configuration.
|
29
|
+
|
30
|
+
*Chedli Bourguiba*
|
31
|
+
|
32
|
+
* Fix `ActiveStorage::Representations::ProxyController` not returning the proper
|
33
|
+
preview image variant for previewable files.
|
34
|
+
|
35
|
+
*Chedli Bourguiba*
|
36
|
+
|
37
|
+
* Fix `ActiveStorage::Representations::ProxyController` to proxy untracked
|
38
|
+
variants.
|
39
|
+
|
40
|
+
*Chedli Bourguiba*
|
41
|
+
|
42
|
+
* Fix direct upload forms when submit button contains nested elements.
|
43
|
+
|
44
|
+
*Marc Köhlbrugge*
|
45
|
+
|
46
|
+
* When using the `preprocessed: true` option, avoid enqueuing transform jobs
|
47
|
+
for blobs that are not representable.
|
48
|
+
|
49
|
+
*Chedli Bourguiba*
|
50
|
+
|
51
|
+
* Process preview image variant when calling `ActiveStorage::Preview#processed`.
|
52
|
+
For example, `attached_pdf.preview(:thumb).processed` will now immediately
|
53
|
+
generate the full-sized preview image and the `:thumb` variant of it.
|
54
|
+
Previously, the `:thumb` variant would not be generated until a further call
|
55
|
+
to e.g. `processed.url`.
|
56
|
+
|
57
|
+
*Chedli Bourguiba* and *Jonathan Hefner*
|
58
|
+
|
59
|
+
* Prevent `ActiveRecord::StrictLoadingViolationError` when strict loading is
|
60
|
+
enabled and the variant of an Active Storage preview has already been
|
61
|
+
processed (for example, by calling `ActiveStorage::Preview#url`).
|
62
|
+
|
63
|
+
*Jonathan Hefner*
|
64
|
+
|
65
|
+
* Fix `preprocessed: true` option for named variants of previewable files.
|
66
|
+
|
67
|
+
*Nico Wenterodt*
|
68
|
+
|
69
|
+
|
1
70
|
## Rails 7.1.2 (November 10, 2023) ##
|
2
71
|
|
3
72
|
* No changes.
|
@@ -771,9 +771,9 @@ function start() {
|
|
771
771
|
}
|
772
772
|
|
773
773
|
function didClick(event) {
|
774
|
-
const
|
775
|
-
if (
|
776
|
-
submitButtonsByForm.set(
|
774
|
+
const button = event.target.closest("button, input");
|
775
|
+
if (button && button.type === "submit" && button.form) {
|
776
|
+
submitButtonsByForm.set(button.form, button);
|
777
777
|
}
|
778
778
|
}
|
779
779
|
|
@@ -754,9 +754,9 @@
|
|
754
754
|
}
|
755
755
|
}
|
756
756
|
function didClick(event) {
|
757
|
-
const
|
758
|
-
if (
|
759
|
-
submitButtonsByForm.set(
|
757
|
+
const button = event.target.closest("button, input");
|
758
|
+
if (button && button.type === "submit" && button.form) {
|
759
|
+
submitButtonsByForm.set(button.form, button);
|
760
760
|
}
|
761
761
|
}
|
762
762
|
function didSubmitForm(event) {
|
@@ -12,7 +12,7 @@ class ActiveStorage::Representations::ProxyController < ActiveStorage::Represent
|
|
12
12
|
|
13
13
|
def show
|
14
14
|
http_cache_forever public: true do
|
15
|
-
send_blob_stream @representation
|
15
|
+
send_blob_stream @representation, disposition: params[:disposition]
|
16
16
|
end
|
17
17
|
end
|
18
18
|
end
|
@@ -15,9 +15,9 @@ export function start() {
|
|
15
15
|
}
|
16
16
|
|
17
17
|
function didClick(event) {
|
18
|
-
const
|
19
|
-
if (
|
20
|
-
submitButtonsByForm.set(
|
18
|
+
const button = event.target.closest("button, input")
|
19
|
+
if (button && button.type === "submit" && button.form) {
|
20
|
+
submitButtonsByForm.set(button.form, button)
|
21
21
|
}
|
22
22
|
}
|
23
23
|
|
@@ -3,10 +3,10 @@
|
|
3
3
|
class ActiveStorage::TransformJob < ActiveStorage::BaseJob
|
4
4
|
queue_as { ActiveStorage.queues[:transform] }
|
5
5
|
|
6
|
-
discard_on ActiveRecord::RecordNotFound
|
6
|
+
discard_on ActiveRecord::RecordNotFound, ActiveStorage::UnrepresentableError
|
7
7
|
retry_on ActiveStorage::IntegrityError, attempts: 10, wait: :polynomially_longer
|
8
8
|
|
9
9
|
def perform(blob, transformations)
|
10
|
-
blob.
|
10
|
+
blob.representation(transformations).processed
|
11
11
|
end
|
12
12
|
end
|
@@ -18,8 +18,6 @@ require "active_support/core_ext/module/delegation"
|
|
18
18
|
# # preloads blobs and variant records (if using `ActiveStorage.track_variants`)
|
19
19
|
# User.first.avatars.with_all_variant_records
|
20
20
|
class ActiveStorage::Attachment < ActiveStorage::Record
|
21
|
-
self.table_name = "active_storage_attachments"
|
22
|
-
|
23
21
|
##
|
24
22
|
# :method:
|
25
23
|
#
|
@@ -44,7 +42,10 @@ class ActiveStorage::Attachment < ActiveStorage::Record
|
|
44
42
|
# Eager load all variant records on an attachment at once.
|
45
43
|
#
|
46
44
|
# User.first.avatars.with_all_variant_records
|
47
|
-
scope :with_all_variant_records, -> { includes(blob: {
|
45
|
+
scope :with_all_variant_records, -> { includes(blob: {
|
46
|
+
variant_records: { image_attachment: :blob },
|
47
|
+
preview_image_attachment: { blob: { variant_records: { image_attachment: :blob } } }
|
48
|
+
}) }
|
48
49
|
|
49
50
|
# Synchronously deletes the attachment and {purges the blob}[rdoc-ref:ActiveStorage::Blob#purge].
|
50
51
|
def purge
|
@@ -99,7 +99,7 @@ module ActiveStorage::Blob::Representable
|
|
99
99
|
end
|
100
100
|
|
101
101
|
def preprocessed(transformations) # :nodoc:
|
102
|
-
ActiveStorage::TransformJob.perform_later(self, transformations)
|
102
|
+
ActiveStorage::TransformJob.perform_later(self, transformations) if representable?
|
103
103
|
end
|
104
104
|
|
105
105
|
private
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ActiveStorage::Blob::Servable # :nodoc:
|
4
|
+
def content_type_for_serving
|
5
|
+
forcibly_serve_as_binary? ? ActiveStorage.binary_content_type : content_type
|
6
|
+
end
|
7
|
+
|
8
|
+
def forced_disposition_for_serving
|
9
|
+
if forcibly_serve_as_binary? || !allowed_inline?
|
10
|
+
:attachment
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
def forcibly_serve_as_binary?
|
16
|
+
ActiveStorage.content_types_to_serve_as_binary.include?(content_type)
|
17
|
+
end
|
18
|
+
|
19
|
+
def allowed_inline?
|
20
|
+
ActiveStorage.content_types_allowed_inline.include?(content_type)
|
21
|
+
end
|
22
|
+
end
|
@@ -20,8 +20,7 @@ class ActiveStorage::Blob < ActiveStorage::Record
|
|
20
20
|
include Analyzable
|
21
21
|
include Identifiable
|
22
22
|
include Representable
|
23
|
-
|
24
|
-
self.table_name = "active_storage_blobs"
|
23
|
+
include Servable
|
25
24
|
|
26
25
|
MINIMUM_TOKEN_LENGTH = 28
|
27
26
|
|
@@ -138,7 +137,10 @@ class ActiveStorage::Blob < ActiveStorage::Record
|
|
138
137
|
|
139
138
|
def scope_for_strict_loading # :nodoc:
|
140
139
|
if strict_loading_by_default? && ActiveStorage.track_variants
|
141
|
-
includes(
|
140
|
+
includes(
|
141
|
+
variant_records: { image_attachment: :blob },
|
142
|
+
preview_image_attachment: { blob: { variant_records: { image_attachment: :blob } } }
|
143
|
+
)
|
142
144
|
else
|
143
145
|
all
|
144
146
|
end
|
@@ -226,16 +228,6 @@ class ActiveStorage::Blob < ActiveStorage::Record
|
|
226
228
|
service.headers_for_direct_upload key, filename: filename, content_type: content_type, content_length: byte_size, checksum: checksum, custom_metadata: custom_metadata
|
227
229
|
end
|
228
230
|
|
229
|
-
def content_type_for_serving # :nodoc:
|
230
|
-
forcibly_serve_as_binary? ? ActiveStorage.binary_content_type : content_type
|
231
|
-
end
|
232
|
-
|
233
|
-
def forced_disposition_for_serving # :nodoc:
|
234
|
-
if forcibly_serve_as_binary? || !allowed_inline?
|
235
|
-
:attachment
|
236
|
-
end
|
237
|
-
end
|
238
|
-
|
239
231
|
|
240
232
|
# Uploads the +io+ to the service on the +key+ for this blob. Blobs are intended to be immutable, so you shouldn't be
|
241
233
|
# using this method after a file has already been uploaded to fit with a blob. If you want to create a derivative blob,
|
@@ -354,14 +346,6 @@ class ActiveStorage::Blob < ActiveStorage::Record
|
|
354
346
|
Marcel::MimeType.for io, name: filename.to_s, declared_type: content_type
|
355
347
|
end
|
356
348
|
|
357
|
-
def forcibly_serve_as_binary?
|
358
|
-
ActiveStorage.content_types_to_serve_as_binary.include?(content_type)
|
359
|
-
end
|
360
|
-
|
361
|
-
def allowed_inline?
|
362
|
-
ActiveStorage.content_types_allowed_inline.include?(content_type)
|
363
|
-
end
|
364
|
-
|
365
349
|
def web_image?
|
366
350
|
ActiveStorage.web_image_content_types.include?(content_type)
|
367
351
|
end
|
@@ -31,15 +31,19 @@
|
|
31
31
|
# These libraries are not provided by \Rails. You must install them yourself to use the built-in previewers. Before you
|
32
32
|
# install and use third-party software, make sure you understand the licensing implications of doing so.
|
33
33
|
class ActiveStorage::Preview
|
34
|
+
include ActiveStorage::Blob::Servable
|
35
|
+
|
34
36
|
class UnprocessedError < StandardError; end
|
35
37
|
|
38
|
+
delegate :filename, :content_type, to: :variant
|
39
|
+
|
36
40
|
attr_reader :blob, :variation
|
37
41
|
|
38
42
|
def initialize(blob, variation_or_variation_key)
|
39
43
|
@blob, @variation = blob, ActiveStorage::Variation.wrap(variation_or_variation_key)
|
40
44
|
end
|
41
45
|
|
42
|
-
# Processes the preview if it has not been processed yet. Returns the receiving Preview instance for convenience:
|
46
|
+
# Processes the preview if it has not been processed yet. Returns the receiving +ActiveStorage::Preview+ instance for convenience:
|
43
47
|
#
|
44
48
|
# blob.preview(resize_to_limit: [100, 100]).processed.url
|
45
49
|
#
|
@@ -47,6 +51,7 @@ class ActiveStorage::Preview
|
|
47
51
|
# image is stored with the blob, it is only generated once.
|
48
52
|
def processed
|
49
53
|
process unless processed?
|
54
|
+
variant.processed
|
50
55
|
self
|
51
56
|
end
|
52
57
|
|
@@ -53,6 +53,8 @@
|
|
53
53
|
# * {ImageProcessing::Vips}[https://github.com/janko/image_processing/blob/master/doc/vips.md#methods]
|
54
54
|
# * {ruby-vips reference}[http://www.rubydoc.info/gems/ruby-vips/Vips/Image]
|
55
55
|
class ActiveStorage::Variant
|
56
|
+
include ActiveStorage::Blob::Servable
|
57
|
+
|
56
58
|
attr_reader :blob, :variation
|
57
59
|
delegate :service, to: :blob
|
58
60
|
delegate :content_type, to: :variation
|
@@ -5,6 +5,8 @@
|
|
5
5
|
# Like an ActiveStorage::Variant, but keeps detail about the variant in the database as an
|
6
6
|
# ActiveStorage::VariantRecord. This is only used if +ActiveStorage.track_variants+ is enabled.
|
7
7
|
class ActiveStorage::VariantWithRecord
|
8
|
+
include ActiveStorage::Blob::Servable
|
9
|
+
|
8
10
|
attr_reader :blob, :variation
|
9
11
|
delegate :service, to: :blob
|
10
12
|
delegate :content_type, to: :variation
|
@@ -116,7 +116,10 @@ module ActiveStorage
|
|
116
116
|
|
117
117
|
scope :"with_attached_#{name}", -> {
|
118
118
|
if ActiveStorage.track_variants
|
119
|
-
includes("#{name}_attachment": { blob: {
|
119
|
+
includes("#{name}_attachment": { blob: {
|
120
|
+
variant_records: { image_attachment: :blob },
|
121
|
+
preview_image_attachment: { blob: { variant_records: { image_attachment: :blob } } }
|
122
|
+
} })
|
120
123
|
else
|
121
124
|
includes("#{name}_attachment": :blob)
|
122
125
|
end
|
@@ -203,7 +206,10 @@ module ActiveStorage
|
|
203
206
|
|
204
207
|
scope :"with_attached_#{name}", -> {
|
205
208
|
if ActiveStorage.track_variants
|
206
|
-
includes("#{name}_attachments": { blob: {
|
209
|
+
includes("#{name}_attachments": { blob: {
|
210
|
+
variant_records: { image_attachment: :blob },
|
211
|
+
preview_image_attachment: { blob: { variant_records: { image_attachment: :blob } } }
|
212
|
+
} })
|
207
213
|
else
|
208
214
|
includes("#{name}_attachments": :blob)
|
209
215
|
end
|
@@ -26,9 +26,13 @@ module ActiveStorage
|
|
26
26
|
# has_one_attached :thumbnail
|
27
27
|
# end
|
28
28
|
#
|
29
|
+
# <code></code>
|
30
|
+
#
|
29
31
|
# # fixtures/active_storage/blobs.yml
|
30
32
|
# first_thumbnail_blob: <%= ActiveStorage::FixtureSet.blob filename: "first.png" %>
|
31
33
|
#
|
34
|
+
# <code></code>
|
35
|
+
#
|
32
36
|
# # fixtures/active_storage/attachments.yml
|
33
37
|
# first_thumbnail_attachment:
|
34
38
|
# name: thumbnail
|
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.
|
4
|
+
version: 7.1.3.4
|
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:
|
11
|
+
date: 2024-06-04 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.
|
19
|
+
version: 7.1.3.4
|
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.
|
26
|
+
version: 7.1.3.4
|
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.
|
33
|
+
version: 7.1.3.4
|
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.
|
40
|
+
version: 7.1.3.4
|
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.
|
47
|
+
version: 7.1.3.4
|
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.
|
54
|
+
version: 7.1.3.4
|
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.
|
61
|
+
version: 7.1.3.4
|
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.
|
68
|
+
version: 7.1.3.4
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: marcel
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -123,6 +123,7 @@ files:
|
|
123
123
|
- app/models/active_storage/blob/analyzable.rb
|
124
124
|
- app/models/active_storage/blob/identifiable.rb
|
125
125
|
- app/models/active_storage/blob/representable.rb
|
126
|
+
- app/models/active_storage/blob/servable.rb
|
126
127
|
- app/models/active_storage/current.rb
|
127
128
|
- app/models/active_storage/filename.rb
|
128
129
|
- app/models/active_storage/named_variant.rb
|
@@ -188,10 +189,10 @@ licenses:
|
|
188
189
|
- MIT
|
189
190
|
metadata:
|
190
191
|
bug_tracker_uri: https://github.com/rails/rails/issues
|
191
|
-
changelog_uri: https://github.com/rails/rails/blob/v7.1.
|
192
|
-
documentation_uri: https://api.rubyonrails.org/v7.1.
|
192
|
+
changelog_uri: https://github.com/rails/rails/blob/v7.1.3.4/activestorage/CHANGELOG.md
|
193
|
+
documentation_uri: https://api.rubyonrails.org/v7.1.3.4/
|
193
194
|
mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
|
194
|
-
source_code_uri: https://github.com/rails/rails/tree/v7.1.
|
195
|
+
source_code_uri: https://github.com/rails/rails/tree/v7.1.3.4/activestorage
|
195
196
|
rubygems_mfa_required: 'true'
|
196
197
|
post_install_message:
|
197
198
|
rdoc_options: []
|
@@ -208,7 +209,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
208
209
|
- !ruby/object:Gem::Version
|
209
210
|
version: '0'
|
210
211
|
requirements: []
|
211
|
-
rubygems_version: 3.
|
212
|
+
rubygems_version: 3.3.27
|
212
213
|
signing_key:
|
213
214
|
specification_version: 4
|
214
215
|
summary: Local and cloud file storage framework.
|