activestorage 6.0.0 → 6.0.1.rc1
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 +13 -0
- data/app/jobs/active_storage/analyze_job.rb +1 -0
- data/app/models/active_storage/blob.rb +20 -9
- data/lib/active_storage/attached/model.rb +2 -2
- data/lib/active_storage/gem_version.rb +2 -2
- metadata +16 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6d424efd1fa5c4046399c3274aca014257a2e72230feaf69e3aa7217ad65fc21
|
4
|
+
data.tar.gz: a1d549b32cd85fe13d6577ade41f2269588ab483b4a3e6c4f376a6c3ff9feeeb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 84ed4b45a68bdf07bbe8b994d07338eecfe552a5fe37c98913dbcd0e5f3aa67328571de163cceac14c836533ffd1d3e06af6177614777415f110f05eab2b305c
|
7
|
+
data.tar.gz: 9c5824e5f4a5084ef5635abd5f15ecc6182f6a713cafcc4959aa6873d0c701722df149278f6bc27c7d9ac7ef2dca122595830ecb4e98d7199b7f5629c5e71f7a
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,16 @@
|
|
1
|
+
## Rails 6.0.1.rc1 (October 31, 2019) ##
|
2
|
+
|
3
|
+
* `ActiveStorage::AnalyzeJob`s are discarded on `ActiveRecord::RecordNotFound` errors.
|
4
|
+
|
5
|
+
*George Claghorn*
|
6
|
+
|
7
|
+
* Blobs are recorded in the database before being uploaded to the service.
|
8
|
+
This fixes that generated blob keys could silently collide, leading to
|
9
|
+
data loss.
|
10
|
+
|
11
|
+
*Julik Tarkhanov*
|
12
|
+
|
13
|
+
|
1
14
|
## Rails 6.0.0 (August 16, 2019) ##
|
2
15
|
|
3
16
|
* No changes.
|
@@ -5,8 +5,9 @@ require "active_storage/downloader"
|
|
5
5
|
# A blob is a record that contains the metadata about a file and a key for where that file resides on the service.
|
6
6
|
# Blobs can be created in two ways:
|
7
7
|
#
|
8
|
-
# 1.
|
9
|
-
#
|
8
|
+
# 1. Ahead of the file being uploaded server-side to the service, via <tt>create_and_upload!</tt>. A rewindable
|
9
|
+
# <tt>io</tt> with the file contents must be available at the server for this operation.
|
10
|
+
# 2. Ahead of the file being directly uploaded client-side to the service, via <tt>create_before_direct_upload!</tt>.
|
10
11
|
#
|
11
12
|
# The first option doesn't require any client-side JavaScript integration, and can be used by any other back-end
|
12
13
|
# service that deals with files. The second option is faster, since you're not using your own server as a staging
|
@@ -63,14 +64,23 @@ class ActiveStorage::Blob < ActiveRecord::Base
|
|
63
64
|
end
|
64
65
|
end
|
65
66
|
|
66
|
-
|
67
|
-
|
68
|
-
|
67
|
+
def create_after_unfurling!(io:, filename:, content_type: nil, metadata: nil, identify: true, record: nil) #:nodoc:
|
68
|
+
build_after_unfurling(io: io, filename: filename, content_type: content_type, metadata: metadata, identify: identify).tap(&:save!)
|
69
|
+
end
|
70
|
+
|
71
|
+
# Creates a new blob instance and then uploads the contents of the given <tt>io</tt> to the
|
72
|
+
# service. The blob instance is saved before the upload begins to avoid clobbering another due
|
73
|
+
# to key collisions.
|
74
|
+
#
|
69
75
|
# When providing a content type, pass <tt>identify: false</tt> to bypass automatic content type inference.
|
70
|
-
def
|
71
|
-
|
76
|
+
def create_and_upload!(io:, filename:, content_type: nil, metadata: nil, identify: true, record: nil)
|
77
|
+
create_after_unfurling!(io: io, filename: filename, content_type: content_type, metadata: metadata, identify: identify).tap do |blob|
|
78
|
+
blob.upload_without_unfurling(io)
|
79
|
+
end
|
72
80
|
end
|
73
81
|
|
82
|
+
alias_method :create_after_upload!, :create_and_upload!
|
83
|
+
|
74
84
|
# Returns a saved blob _without_ uploading a file to the service. This blob will point to a key where there is
|
75
85
|
# no file yet. It's intended to be used together with a client-side upload, which will first create the blob
|
76
86
|
# in order to produce the signed URL for uploading. This signed URL points to the key generated by the blob.
|
@@ -165,8 +175,9 @@ class ActiveStorage::Blob < ActiveRecord::Base
|
|
165
175
|
# and store that in +byte_size+ on the blob record. The content type is automatically extracted from the +io+ unless
|
166
176
|
# you specify a +content_type+ and pass +identify+ as false.
|
167
177
|
#
|
168
|
-
# Normally, you do not have to call this method directly at all. Use the
|
169
|
-
#
|
178
|
+
# Normally, you do not have to call this method directly at all. Use the +create_and_upload!+ class method instead.
|
179
|
+
# If you do use this method directly, make sure you are using it on a persisted Blob as otherwise another blob's
|
180
|
+
# data might get overwritten on the service.
|
170
181
|
def upload(io, identify: true)
|
171
182
|
unfurl io, identify: identify
|
172
183
|
upload_without_unfurling io
|
@@ -95,13 +95,13 @@ module ActiveStorage
|
|
95
95
|
def #{name}=(attachables)
|
96
96
|
if ActiveStorage.replace_on_assign_to_many
|
97
97
|
attachment_changes["#{name}"] =
|
98
|
-
if
|
98
|
+
if Array(attachables).none?
|
99
99
|
ActiveStorage::Attached::Changes::DeleteMany.new("#{name}", self)
|
100
100
|
else
|
101
101
|
ActiveStorage::Attached::Changes::CreateMany.new("#{name}", self, attachables)
|
102
102
|
end
|
103
103
|
else
|
104
|
-
if
|
104
|
+
if Array(attachables).any?
|
105
105
|
attachment_changes["#{name}"] =
|
106
106
|
ActiveStorage::Attached::Changes::CreateMany.new("#{name}", self, #{name}.blobs + attachables)
|
107
107
|
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.0.
|
4
|
+
version: 6.0.1.rc1
|
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: 2019-
|
11
|
+
date: 2019-10-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionpack
|
@@ -16,42 +16,42 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 6.0.
|
19
|
+
version: 6.0.1.rc1
|
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.0.
|
26
|
+
version: 6.0.1.rc1
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: activejob
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - '='
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 6.0.
|
33
|
+
version: 6.0.1.rc1
|
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.0.
|
40
|
+
version: 6.0.1.rc1
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: activerecord
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - '='
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 6.0.
|
47
|
+
version: 6.0.1.rc1
|
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.0.
|
54
|
+
version: 6.0.1.rc1
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: marcel
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -150,8 +150,11 @@ homepage: https://rubyonrails.org
|
|
150
150
|
licenses:
|
151
151
|
- MIT
|
152
152
|
metadata:
|
153
|
-
|
154
|
-
changelog_uri: https://github.com/rails/rails/blob/v6.0.
|
153
|
+
bug_tracker_uri: https://github.com/rails/rails/issues
|
154
|
+
changelog_uri: https://github.com/rails/rails/blob/v6.0.1.rc1/activestorage/CHANGELOG.md
|
155
|
+
documentation_uri: https://api.rubyonrails.org/v6.0.1.rc1/
|
156
|
+
mailing_list_uri: https://groups.google.com/forum/#!forum/rubyonrails-talk
|
157
|
+
source_code_uri: https://github.com/rails/rails/tree/v6.0.1.rc1/activestorage
|
155
158
|
post_install_message:
|
156
159
|
rdoc_options: []
|
157
160
|
require_paths:
|
@@ -163,11 +166,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
163
166
|
version: 2.5.0
|
164
167
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
165
168
|
requirements:
|
166
|
-
- - "
|
169
|
+
- - ">"
|
167
170
|
- !ruby/object:Gem::Version
|
168
|
-
version:
|
171
|
+
version: 1.3.1
|
169
172
|
requirements: []
|
170
|
-
rubygems_version: 3.0.
|
173
|
+
rubygems_version: 3.0.3
|
171
174
|
signing_key:
|
172
175
|
specification_version: 4
|
173
176
|
summary: Local and cloud file storage framework.
|