activestorage-aliyun 0.5.1 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/lib/active_storage/service/aliyun_service.rb +8 -5
- data/lib/active_storage_aliyun/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 13d2065fdd23d9b862a8aab77c90ff972dccf68c9e42ee04e0fb04e62328026f
|
4
|
+
data.tar.gz: 3b3e025934acb414c4510562b5bd76dcb2217a4df52632e53fe80745a037ec02
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e30124997158c3a6f42fd2810e582fd729955bab04c180cd5ef1bd4b37d9bb666e3abc9d5cfb37125ed3c46a0afdccbe41bc588863f5e0371f5dcdba0de75a31
|
7
|
+
data.tar.gz: 639a5f5ecdb2a9b3d0b1bdb47937893466bb15c61361412ee38d68f9755d9a1ca01f5a20b34e86cb8a9dfc20b25872adbfb40d43bda8d653207e3af456e1a0b0
|
data/CHANGELOG.md
CHANGED
@@ -8,9 +8,9 @@ module ActiveStorage
|
|
8
8
|
@config = config
|
9
9
|
end
|
10
10
|
|
11
|
-
def upload(key, io, checksum: nil)
|
11
|
+
def upload(key, io, checksum: nil, content_type: nil, disposition: nil, filename: nil)
|
12
12
|
instrument :upload, key: key, checksum: checksum do
|
13
|
-
content_type
|
13
|
+
content_type ||= Marcel::MimeType.for(io)
|
14
14
|
bucket.put_object(path_for(key), content_type: content_type) do |stream|
|
15
15
|
stream << io.read
|
16
16
|
end
|
@@ -118,10 +118,13 @@ module ActiveStorage
|
|
118
118
|
|
119
119
|
def path_for(key)
|
120
120
|
root_path = config.fetch(:path, nil)
|
121
|
-
|
121
|
+
if root_path.blank? || root_path == "/"
|
122
|
+
full_path = key
|
123
|
+
else
|
124
|
+
full_path = File.join(root_path, key)
|
125
|
+
end
|
122
126
|
|
123
|
-
|
124
|
-
File.join(root_path, key)
|
127
|
+
full_path.gsub(/^\//, "").gsub(/[\/]+/, "/")
|
125
128
|
end
|
126
129
|
|
127
130
|
def object_url(key, sign:, expires_in: 60, params: {})
|