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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b6de8c6a19e97cc39b456d90df755854de54dd4338b123c37d0276055056514f
4
- data.tar.gz: 93f6427de6343b3d65be549c6d88676ed6141c17c66457f2a1848d200a2bfcf5
3
+ metadata.gz: 13d2065fdd23d9b862a8aab77c90ff972dccf68c9e42ee04e0fb04e62328026f
4
+ data.tar.gz: 3b3e025934acb414c4510562b5bd76dcb2217a4df52632e53fe80745a037ec02
5
5
  SHA512:
6
- metadata.gz: ccb3cd37cd09c9dae72ee43fca32b5583900d184f12ea10b774d75f4b3b41df2139f34a308849e28a6820cb9f88e7f4de16a7fd30d4f4eb62dc1f4988ffc8187
7
- data.tar.gz: 75de0836b30d849cd90397b0140b7e11ac01d0768effa5046f64d208d2027f32b06e61e3626568461f25aa0e020407866520019683ebd254294d4d6884586d0d
6
+ metadata.gz: e30124997158c3a6f42fd2810e582fd729955bab04c180cd5ef1bd4b37d9bb666e3abc9d5cfb37125ed3c46a0afdccbe41bc588863f5e0371f5dcdba0de75a31
7
+ data.tar.gz: 639a5f5ecdb2a9b3d0b1bdb47937893466bb15c61361412ee38d68f9755d9a1ca01f5a20b34e86cb8a9dfc20b25872adbfb40d43bda8d653207e3af456e1a0b0
@@ -1,3 +1,8 @@
1
+ ## 0.6.0
2
+
3
+ - Fix upload method option for Rails 5.2.1.1
4
+ - Fix signature issue when config path is / #20
5
+
1
6
  ## 0.5.1
2
7
 
3
8
  - Set OSS Object `content-type` on uploading.
@@ -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 = Marcel::MimeType.for(io)
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
- return key unless root_path
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
- root_path = root_path.sub(/^\//, "")
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: {})
@@ -1,3 +1,3 @@
1
1
  module ActiveStorageAliyun
2
- VERSION = '0.5.1'
2
+ VERSION = '0.6.0'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activestorage-aliyun
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Lee