carrierwave-aliyun 0.3.5 → 0.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/carrierwave/aliyun/version.rb +1 -1
- data/lib/carrierwave/storage/aliyun.rb +20 -9
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a8cb423fe32332c16b3621cb4b986b4c33288e73
|
4
|
+
data.tar.gz: 6693a677b786138041c6d4cd44032afd9ae6269f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 67d2dc2aad2650f46f0378594694016ce88a7d217c8ba48a1a087f7ae510884e65356666d1d3a6ee8101478a06d5e543ac7f9532df0c47619966845b94023b9f
|
7
|
+
data.tar.gz: f5a212545459c9604ea38eb6ba7d2839c7f4b830838b25590de9df6c451d34c3a932f188397456006119a3e2f90445014bcd2097d507f8daf69ce42779ea1cb1
|
data/CHANGELOG.md
CHANGED
@@ -49,7 +49,7 @@ module CarrierWave
|
|
49
49
|
content_type = options[:content_type] || "image/jpg"
|
50
50
|
date = gmtdate
|
51
51
|
url = path_to_url(path)
|
52
|
-
|
52
|
+
|
53
53
|
host = URI.parse(url).host
|
54
54
|
|
55
55
|
auth_sign = sign("PUT", bucket_path, content_md5, content_type,date)
|
@@ -62,7 +62,7 @@ module CarrierWave
|
|
62
62
|
"Expect" => "100-Continue"
|
63
63
|
}
|
64
64
|
|
65
|
-
RestClient.put(
|
65
|
+
RestClient.put(url, file, headers)
|
66
66
|
return path_to_url(path, :get => true)
|
67
67
|
end
|
68
68
|
|
@@ -72,9 +72,20 @@ module CarrierWave
|
|
72
72
|
# returns:
|
73
73
|
# file data
|
74
74
|
def get(path)
|
75
|
-
path
|
76
|
-
|
77
|
-
|
75
|
+
path = format_path(path)
|
76
|
+
bucket_path = get_bucket_path(path)
|
77
|
+
date = gmtdate
|
78
|
+
url = path_to_url(path)
|
79
|
+
host = URI.parse(url).host
|
80
|
+
headers = {
|
81
|
+
"Host" => host,
|
82
|
+
"Date" => date,
|
83
|
+
"Authorization" => sign("GET", bucket_path, "", "" ,date)
|
84
|
+
}
|
85
|
+
|
86
|
+
# path = format_path(path)
|
87
|
+
# url = path_to_url(path)
|
88
|
+
RestClient.get(url, headers)
|
78
89
|
end
|
79
90
|
|
80
91
|
# 删除 Remote 的文件
|
@@ -95,8 +106,8 @@ module CarrierWave
|
|
95
106
|
"Date" => date,
|
96
107
|
"Authorization" => sign("DELETE", bucket_path, "", "" ,date)
|
97
108
|
}
|
98
|
-
|
99
|
-
RestClient.delete(
|
109
|
+
|
110
|
+
RestClient.delete(url, headers)
|
100
111
|
return path_to_url(path, :get => true)
|
101
112
|
end
|
102
113
|
|
@@ -130,7 +141,7 @@ module CarrierWave
|
|
130
141
|
private
|
131
142
|
def sign(verb, path, content_md5 = '', content_type = '', date)
|
132
143
|
canonicalized_oss_headers = ''
|
133
|
-
canonicalized_resource = "/#{path}"
|
144
|
+
canonicalized_resource = "/#{URI.decode(path)}"
|
134
145
|
string_to_sign = "#{verb}\n\n#{content_type}\n#{date}\n#{canonicalized_oss_headers}#{canonicalized_resource}"
|
135
146
|
digest = OpenSSL::Digest.new('sha1')
|
136
147
|
h = OpenSSL::HMAC.digest(digest, @aliyun_access_key, string_to_sign)
|
@@ -142,7 +153,7 @@ module CarrierWave
|
|
142
153
|
class File < CarrierWave::SanitizedFile
|
143
154
|
def initialize(uploader, base, path)
|
144
155
|
@uploader = uploader
|
145
|
-
@path = path
|
156
|
+
@path = URI.encode(path)
|
146
157
|
@base = base
|
147
158
|
end
|
148
159
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: carrierwave-aliyun
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jason Lee
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-11-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: carrierwave
|
@@ -82,7 +82,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
82
82
|
version: '0'
|
83
83
|
requirements: []
|
84
84
|
rubyforge_project:
|
85
|
-
rubygems_version: 2.4.
|
85
|
+
rubygems_version: 2.4.8
|
86
86
|
signing_key:
|
87
87
|
specification_version: 4
|
88
88
|
summary: Aliyun OSS support for Carrierwave
|
@@ -93,4 +93,3 @@ test_files:
|
|
93
93
|
- spec/foo.zip
|
94
94
|
- spec/spec_helper.rb
|
95
95
|
- spec/upload_spec.rb
|
96
|
-
has_rdoc:
|