carrierwave-aliyun 0.3.0 → 0.3.1

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
  SHA1:
3
- metadata.gz: 6c88a9af587b855318be9ced43af6fd29e964f40
4
- data.tar.gz: ecab21ea3488317eeb406fdf71024181e1610328
3
+ metadata.gz: 2b7c6794e4b53be8b1781733433933bb0fcec534
4
+ data.tar.gz: cbec6afebb360c4085155ce1f93d96657306c075
5
5
  SHA512:
6
- metadata.gz: 37a7b3e42a51bae11d7cd9f829c827f4eea442e79aa34895e835a3a95203a37702f1d1a6a9fde48eed1afa9346e0d70486a378ddac37f89c4caf21f958e36315
7
- data.tar.gz: e9418dafc9f763fc80006d13e99a5c968349a06fbb3b7675944eb99d7927de4fde32e680e2a3270cb7b12f1bd8f69837813fb838415c5cb73b6d268f59e5c3fa
6
+ metadata.gz: a51ac3e32565f55992a3ca2ff282c958c30da2be5739a27faf5aafe5e735cef28e54aa1384f9417dc40f8dfdfbf79e826d1a166d70a502c7838a224e9c0e49f3
7
+ data.tar.gz: 189874b6216fb7345d8799cb33284f9104d8a64d5444bae4ebee61d57e52c792daf9bbaece22a0fe5b218e7f776cabf73641c62d6435ceef21417c17dbf49457
data/Changelogs.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.3.1
2
+
3
+ * 修复当文件名中包含了 "+",在 OSS 中上传会遇到签名不对应的问题;
4
+
1
5
  ## 0.3.0
2
6
 
3
7
  * 新增 `aliyun_area` 参数,用于配置 OSS 所在地区数据中心;
@@ -32,4 +36,4 @@
32
36
 
33
37
  ## 0.1.0
34
38
 
35
- * 功能实现.
39
+ * 功能实现.
@@ -1,7 +1,7 @@
1
1
  module CarrierWave
2
2
  module Aliyun
3
3
  class Version
4
- MAJOR, MINOR, PATCH = 0, 3, 0
4
+ MAJOR, MINOR, PATCH = 0, 3, 1
5
5
 
6
6
  ##
7
7
  # Returns the major version ( big release based off of multiple minor releases )
@@ -52,10 +52,26 @@ module CarrierWave
52
52
  "Host" => @aliyun_upload_host,
53
53
  "Expect" => "100-Continue"
54
54
  }
55
- RestClient.put(URI.encode(url), file, headers)
55
+ RestClient.put(URI.encode(url).gsub("+", "%2B"), file, headers)
56
56
  return path_to_url(path, :get => true)
57
57
  end
58
58
 
59
+
60
+ =begin rdoc
61
+ 读取文件
62
+
63
+ == 参数:
64
+ - path - remote 存储路径
65
+
66
+ == 返回值:
67
+ 图片文件
68
+ =end
69
+ def get(path)
70
+ path = format_path(path)
71
+ url = path_to_url(path)
72
+ RestClient.get(URI.encode(url))
73
+ end
74
+
59
75
  =begin rdoc
60
76
  删除 Remote 的文件
61
77
 
@@ -75,7 +91,7 @@ module CarrierWave
75
91
  "Authorization" => sign("DELETE", bucket_path, "", "" ,date)
76
92
  }
77
93
  url = path_to_url(path)
78
- RestClient.delete(URI.encode(url), headers)
94
+ RestClient.delete(URI.encode(url).gsub("+", "%2B"), headers)
79
95
  return path_to_url(path, :get => true)
80
96
  end
81
97
 
@@ -145,7 +161,8 @@ module CarrierWave
145
161
  #
146
162
  def read
147
163
  object = oss_connection.get(@path)
148
- object.data
164
+ @headers = object.headers
165
+ object.body
149
166
  end
150
167
 
151
168
  ##
@@ -166,6 +183,14 @@ module CarrierWave
166
183
  oss_connection.path_to_url(@path, :get => true)
167
184
  end
168
185
 
186
+ def content_type
187
+ headers[:content_type]
188
+ end
189
+
190
+ def content_type=(new_content_type)
191
+ headers[:content_type] = new_content_type
192
+ end
193
+
169
194
  def store(file, opts = {})
170
195
  oss_connection.put(@path, file, opts)
171
196
  end
metadata CHANGED
@@ -1,41 +1,41 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: carrierwave-aliyun
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Lee
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-02 00:00:00.000000000 Z
11
+ date: 2014-08-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: carrierwave
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: 0.5.7
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
26
  version: 0.5.7
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rest-client
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: 1.6.7
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
40
  version: 1.6.7
41
41
  description: Aliyun OSS support for Carrierwave
@@ -45,9 +45,9 @@ executables: []
45
45
  extensions: []
46
46
  extra_rdoc_files: []
47
47
  files:
48
- - .gitignore
49
- - .rspec
50
- - .travis.yml
48
+ - ".gitignore"
49
+ - ".rspec"
50
+ - ".travis.yml"
51
51
  - Changelogs.md
52
52
  - Gemfile
53
53
  - README.md
@@ -72,17 +72,17 @@ require_paths:
72
72
  - lib
73
73
  required_ruby_version: !ruby/object:Gem::Requirement
74
74
  requirements:
75
- - - '>='
75
+ - - ">="
76
76
  - !ruby/object:Gem::Version
77
77
  version: '0'
78
78
  required_rubygems_version: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - '>='
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  requirements: []
84
84
  rubyforge_project:
85
- rubygems_version: 2.1.11
85
+ rubygems_version: 2.2.2
86
86
  signing_key:
87
87
  specification_version: 4
88
88
  summary: Aliyun OSS support for Carrierwave
@@ -93,3 +93,4 @@ test_files:
93
93
  - spec/foo.zip
94
94
  - spec/spec_helper.rb
95
95
  - spec/upload_spec.rb
96
+ has_rdoc: