activestorage 6.1.3.2 → 6.1.4
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of activestorage might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +30 -0
- data/app/controllers/active_storage/representations/base_controller.rb +14 -0
- data/app/controllers/active_storage/representations/proxy_controller.rb +3 -9
- data/app/controllers/active_storage/representations/redirect_controller.rb +2 -4
- data/app/models/active_storage/blob.rb +1 -1
- data/app/models/active_storage/blob/representable.rb +1 -1
- data/app/models/active_storage/variant.rb +1 -1
- data/app/models/active_storage/variant_with_record.rb +1 -1
- data/lib/active_storage.rb +2 -0
- data/lib/active_storage/engine.rb +1 -0
- data/lib/active_storage/errors.rb +3 -0
- data/lib/active_storage/gem_version.rb +2 -2
- data/lib/active_storage/previewer.rb +10 -1
- data/lib/active_storage/previewer/video_previewer.rb +1 -1
- data/lib/tasks/activestorage.rake +5 -1
- metadata +21 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ef0dd54811cf8da51cb50eca56d076d8749b980ae3db31226b265a151192328d
|
4
|
+
data.tar.gz: c22c17de56c93fd065162900525f3a5f52704c32ed74b7b457347dee1aff2673
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '0792f0c459775a2a6356e5e41bb0bfc310b1cd3c0200f05fde47de567fab433d7ee7d5ccee87644c6bf2d3413605fc31d43e66894af55f0c93a7b05aa0872ec2'
|
7
|
+
data.tar.gz: 48d843ff08c3eaf85f69dbe9d4938d7f9413cc98800af3e2bc96de66f661542aa275cda824e88394b7e49755a65a7fc79697550e619da5db7b336f011a2a31be
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,33 @@
|
|
1
|
+
## Rails 6.1.4 (June 24, 2021) ##
|
2
|
+
|
3
|
+
* The parameters sent to `ffmpeg` for generating a video preview image are now
|
4
|
+
configurable under `config.active_storage.video_preview_arguments`.
|
5
|
+
|
6
|
+
*Brendon Muir*
|
7
|
+
|
8
|
+
* Fix Active Storage update task when running in an engine.
|
9
|
+
|
10
|
+
Justin Malčić*
|
11
|
+
|
12
|
+
* Don't raise an error if the mime type is not recognized.
|
13
|
+
|
14
|
+
Fixes #41777.
|
15
|
+
|
16
|
+
*Alex Ghiculescu*
|
17
|
+
|
18
|
+
* `ActiveStorage::PreviewError` is raised when a previewer is unable to generate a preview image.
|
19
|
+
|
20
|
+
*Alex Robbin*
|
21
|
+
|
22
|
+
* respond with 404 given invalid variation key when asking for representations.
|
23
|
+
|
24
|
+
*George Claghorn*
|
25
|
+
|
26
|
+
* `Blob` creation shouldn't crash if no service selected.
|
27
|
+
|
28
|
+
*Alex Ghiculescu*
|
29
|
+
|
30
|
+
|
1
31
|
## Rails 6.1.3.2 (May 05, 2021) ##
|
2
32
|
|
3
33
|
* No changes.
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class ActiveStorage::Representations::BaseController < ActiveStorage::BaseController #:nodoc:
|
4
|
+
include ActiveStorage::SetBlob
|
5
|
+
|
6
|
+
before_action :set_representation
|
7
|
+
|
8
|
+
private
|
9
|
+
def set_representation
|
10
|
+
@representation = @blob.representation(params[:variation_key]).processed
|
11
|
+
rescue ActiveSupport::MessageVerifier::InvalidSignature
|
12
|
+
head :not_found
|
13
|
+
end
|
14
|
+
end
|
@@ -1,19 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# Proxy files through application. This avoids having a redirect and makes files easier to cache.
|
4
|
-
class ActiveStorage::Representations::ProxyController < ActiveStorage::BaseController
|
5
|
-
include ActiveStorage::SetBlob
|
4
|
+
class ActiveStorage::Representations::ProxyController < ActiveStorage::Representations::BaseController
|
6
5
|
include ActiveStorage::SetHeaders
|
7
6
|
|
8
7
|
def show
|
9
8
|
http_cache_forever public: true do
|
10
|
-
set_content_headers_from representation.image
|
11
|
-
stream representation
|
9
|
+
set_content_headers_from @representation.image
|
10
|
+
stream @representation
|
12
11
|
end
|
13
12
|
end
|
14
|
-
|
15
|
-
private
|
16
|
-
def representation
|
17
|
-
@representation ||= @blob.representation(params[:variation_key]).processed
|
18
|
-
end
|
19
13
|
end
|
@@ -4,11 +4,9 @@
|
|
4
4
|
# Note: These URLs are publicly accessible. If you need to enforce access protection beyond the
|
5
5
|
# security-through-obscurity factor of the signed blob and variation reference, you'll need to implement your own
|
6
6
|
# authenticated redirection controller.
|
7
|
-
class ActiveStorage::Representations::RedirectController < ActiveStorage::BaseController
|
8
|
-
include ActiveStorage::SetBlob
|
9
|
-
|
7
|
+
class ActiveStorage::Representations::RedirectController < ActiveStorage::Representations::BaseController
|
10
8
|
def show
|
11
9
|
expires_in ActiveStorage.service_urls_expire_in
|
12
|
-
redirect_to @
|
10
|
+
redirect_to @representation.url(disposition: params[:disposition])
|
13
11
|
end
|
14
12
|
end
|
@@ -49,7 +49,7 @@ class ActiveStorage::Blob < ActiveStorage::Record
|
|
49
49
|
scope :unattached, -> { where.missing(:attachments) }
|
50
50
|
|
51
51
|
after_initialize do
|
52
|
-
self.service_name ||= self.class.service
|
52
|
+
self.service_name ||= self.class.service&.name
|
53
53
|
end
|
54
54
|
|
55
55
|
after_update_commit :update_service_metadata, if: :content_type_previously_changed?
|
@@ -113,7 +113,7 @@ module ActiveStorage::Blob::Representable
|
|
113
113
|
if filename.extension.present? && MiniMime.lookup_by_extension(filename.extension)&.content_type == content_type
|
114
114
|
filename.extension
|
115
115
|
else
|
116
|
-
MiniMime.lookup_by_content_type(content_type)
|
116
|
+
MiniMime.lookup_by_content_type(content_type)&.extension
|
117
117
|
end
|
118
118
|
end
|
119
119
|
|
@@ -89,7 +89,7 @@ class ActiveStorage::Variant
|
|
89
89
|
end
|
90
90
|
|
91
91
|
def filename
|
92
|
-
ActiveStorage::Filename.new "#{blob.filename.base}.#{variation.format}"
|
92
|
+
ActiveStorage::Filename.new "#{blob.filename.base}.#{variation.format.downcase}"
|
93
93
|
end
|
94
94
|
|
95
95
|
alias_method :content_type_for_serving, :content_type
|
@@ -33,7 +33,7 @@ class ActiveStorage::VariantWithRecord
|
|
33
33
|
def transform_blob
|
34
34
|
blob.open do |input|
|
35
35
|
variation.transform(input) do |output|
|
36
|
-
yield io: output, filename: "#{blob.filename.base}.#{variation.format}",
|
36
|
+
yield io: output, filename: "#{blob.filename.base}.#{variation.format.downcase}",
|
37
37
|
content_type: variation.content_type, service_name: blob.service.name
|
38
38
|
end
|
39
39
|
end
|
data/lib/active_storage.rb
CHANGED
@@ -67,6 +67,8 @@ module ActiveStorage
|
|
67
67
|
mattr_accessor :replace_on_assign_to_many, default: false
|
68
68
|
mattr_accessor :track_variants, default: false
|
69
69
|
|
70
|
+
mattr_accessor :video_preview_arguments, default: "-y -vframes 1 -f image2"
|
71
|
+
|
70
72
|
module Transformers
|
71
73
|
extend ActiveSupport::Autoload
|
72
74
|
|
@@ -92,6 +92,7 @@ module ActiveStorage
|
|
92
92
|
ActiveStorage.service_urls_expire_in = app.config.active_storage.service_urls_expire_in || 5.minutes
|
93
93
|
ActiveStorage.content_types_allowed_inline = app.config.active_storage.content_types_allowed_inline || []
|
94
94
|
ActiveStorage.binary_content_type = app.config.active_storage.binary_content_type || "application/octet-stream"
|
95
|
+
ActiveStorage.video_preview_arguments = app.config.active_storage.video_preview_arguments || "-y -vframes 1 -f image2"
|
95
96
|
|
96
97
|
ActiveStorage.replace_on_assign_to_many = app.config.active_storage.replace_on_assign_to_many || false
|
97
98
|
ActiveStorage.track_variants = app.config.active_storage.track_variants || false
|
@@ -23,4 +23,7 @@ module ActiveStorage
|
|
23
23
|
# Raised when ActiveStorage::Blob#download is called on a blob where the
|
24
24
|
# backing file is no longer present in its service.
|
25
25
|
class FileNotFoundError < Error; end
|
26
|
+
|
27
|
+
# Raised when a Previewer is unable to generate a preview image.
|
28
|
+
class PreviewError < Error; end
|
26
29
|
end
|
@@ -70,7 +70,16 @@ module ActiveStorage
|
|
70
70
|
|
71
71
|
def capture(*argv, to:)
|
72
72
|
to.binmode
|
73
|
-
|
73
|
+
|
74
|
+
open_tempfile do |err|
|
75
|
+
IO.popen(argv, err: err) { |out| IO.copy_stream(out, to) }
|
76
|
+
err.rewind
|
77
|
+
|
78
|
+
unless $?.success?
|
79
|
+
raise PreviewError, "#{argv.first} failed (status #{$?.exitstatus}): #{err.read.to_s.chomp}"
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
74
83
|
to.rewind
|
75
84
|
end
|
76
85
|
|
@@ -28,7 +28,7 @@ module ActiveStorage
|
|
28
28
|
|
29
29
|
private
|
30
30
|
def draw_relevant_frame_from(file, &block)
|
31
|
-
draw self.class.ffmpeg_path, "-i", file.path,
|
31
|
+
draw self.class.ffmpeg_path, "-i", file.path, *Shellwords.split(ActiveStorage.video_preview_arguments), "-", &block
|
32
32
|
end
|
33
33
|
end
|
34
34
|
end
|
@@ -17,6 +17,10 @@ namespace :active_storage do
|
|
17
17
|
task update: :environment do
|
18
18
|
ENV["MIGRATIONS_PATH"] = "db/update_migrate"
|
19
19
|
|
20
|
-
Rake::Task
|
20
|
+
if Rake::Task.task_defined?("active_storage:install")
|
21
|
+
Rake::Task["active_storage:install"].invoke
|
22
|
+
else
|
23
|
+
Rake::Task["app:active_storage:install"].invoke
|
24
|
+
end
|
21
25
|
end
|
22
26
|
end
|
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: 6.1.
|
4
|
+
version: 6.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Heinemeier Hansson
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-06-24 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: 6.1.
|
19
|
+
version: 6.1.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: 6.1.
|
26
|
+
version: 6.1.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: 6.1.
|
33
|
+
version: 6.1.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: 6.1.
|
40
|
+
version: 6.1.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: 6.1.
|
47
|
+
version: 6.1.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: 6.1.
|
54
|
+
version: 6.1.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: 6.1.
|
61
|
+
version: 6.1.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: 6.1.
|
68
|
+
version: 6.1.4
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: marcel
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -84,16 +84,16 @@ dependencies:
|
|
84
84
|
name: mini_mime
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - "
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: 1.0
|
89
|
+
version: 1.1.0
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - "
|
94
|
+
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: 1.0
|
96
|
+
version: 1.1.0
|
97
97
|
description: Attach cloud and local files in Rails applications.
|
98
98
|
email: david@loudthinking.com
|
99
99
|
executables: []
|
@@ -109,6 +109,7 @@ files:
|
|
109
109
|
- app/controllers/active_storage/blobs/redirect_controller.rb
|
110
110
|
- app/controllers/active_storage/direct_uploads_controller.rb
|
111
111
|
- app/controllers/active_storage/disk_controller.rb
|
112
|
+
- app/controllers/active_storage/representations/base_controller.rb
|
112
113
|
- app/controllers/active_storage/representations/proxy_controller.rb
|
113
114
|
- app/controllers/active_storage/representations/redirect_controller.rb
|
114
115
|
- app/controllers/concerns/active_storage/file_server.rb
|
@@ -187,11 +188,11 @@ licenses:
|
|
187
188
|
- MIT
|
188
189
|
metadata:
|
189
190
|
bug_tracker_uri: https://github.com/rails/rails/issues
|
190
|
-
changelog_uri: https://github.com/rails/rails/blob/v6.1.
|
191
|
-
documentation_uri: https://api.rubyonrails.org/v6.1.
|
191
|
+
changelog_uri: https://github.com/rails/rails/blob/v6.1.4/activestorage/CHANGELOG.md
|
192
|
+
documentation_uri: https://api.rubyonrails.org/v6.1.4/
|
192
193
|
mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
|
193
|
-
source_code_uri: https://github.com/rails/rails/tree/v6.1.
|
194
|
-
post_install_message:
|
194
|
+
source_code_uri: https://github.com/rails/rails/tree/v6.1.4/activestorage
|
195
|
+
post_install_message:
|
195
196
|
rdoc_options: []
|
196
197
|
require_paths:
|
197
198
|
- lib
|
@@ -207,7 +208,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
207
208
|
version: '0'
|
208
209
|
requirements: []
|
209
210
|
rubygems_version: 3.1.2
|
210
|
-
signing_key:
|
211
|
+
signing_key:
|
211
212
|
specification_version: 4
|
212
213
|
summary: Local and cloud file storage framework.
|
213
214
|
test_files: []
|