carrierwave-aliyun 1.2.2 → 1.2.3

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: '09185a0291f96fed424df86a4be3815f13171b74f4b6d891b945de90bdc3924d'
4
- data.tar.gz: ff50669bd39b9da0ff3b9c5c00c9e646fc0f3f46e7f0b1b45643c9d76abe66fd
3
+ metadata.gz: fd2862b19f1414efc11faf608fba6ecc0ac6a8048dd86d96cdf3ffa4b7ad3c7f
4
+ data.tar.gz: 031b8b1ad35539a5605abae8cebbb17b0b393d68cb4442d00ca1a3b2a97491c3
5
5
  SHA512:
6
- metadata.gz: fd28e434c5bd6d43ccfff8f5b98dff4343d1440c3ded461397b95bde45e280bfde4481e0c06d0af3da8d38009620546c36cd777fd5c6bae893038e94533cc8ba
7
- data.tar.gz: 88a37bc5bbf656be44cb50232943faac2ba26698fdee306f3441f0365e853066fdfb97297b9c7c0012d256ba80f02b69f78af8e585938de7917926dfa473f4a1
6
+ metadata.gz: 6d115a0e6cc1a3262a40a9f5a0a525249fef749e690d5ab7d8aeace8cb9a084881b20d6b0541833ac4c0dc0c47868b0e3805432cd31ff04044763f2b2f084160
7
+ data.tar.gz: d5c5f5ebb6567b441a73412b8670d73f6e0e9a67f867caeabdeea430d14e990e3f3ef7c5644ead6ae892c45feb891f62ed24e5766868381d056444ee6ab2f055
@@ -1,4 +1,9 @@
1
- ## 1.2.1
1
+ ## 1.2.3
2
+
3
+ - 将 Aliyun::OSS 原本的异常原样抛出;
4
+ - 验证对 [传输加速](https://help.aliyun.com/document_detail/131312.html) 的能力,并增加文档说明(实际上之前的版本就支持)。
5
+
6
+ ## 1.2.2
2
7
 
3
8
  - 修正 #79 某些场景中文文件名无法正确上传的问题;
4
9
  - 修正 #70 上传文件以后 tmp 目录依然还残留着 cache 文件的问题;
data/README.md CHANGED
@@ -80,3 +80,20 @@ class AttachmentUploader < CarrierWave::Uploader::Base
80
80
  end
81
81
  end
82
82
  ```
83
+
84
+ ## 启用全球传输加速
85
+
86
+ 阿里云允许我们通过 `oss-accelerate.aliyuncs.com` 的节点来实现全球的传输加速,如果你的需要在境外的服务器传输到国内,或许需要开启这个功能。
87
+
88
+ 你只需要将 CarrierWave Aliyun 的 `aliyun_region` 配置为 `accelerate` 即可。
89
+
90
+ ```rb
91
+ config.aliyun_region = "accelerate"
92
+ ```
93
+
94
+ ### 异常解析
95
+
96
+ > 错误:OSS Transfer Acceleration is not configured on this bucket.
97
+ > 确保有开启 [传输加速](https://help.aliyun.com/document_detail/131312.html),进入 Bucket / 传输管理 / 传输加速 / 开启传输加速。
98
+
99
+ 额外注意:Aliyun OSS 开启传输加速后需要 **30 分钟内全网生效**
@@ -64,14 +64,10 @@ module CarrierWave
64
64
  headers["Content-Type"] = content_type
65
65
  headers["Content-Disposition"] = content_disposition if content_disposition
66
66
 
67
- begin
68
- oss_upload_client.put_object(path, headers: headers) do |stream|
69
- stream << file.read(CHUNK_SIZE) until file.eof?
70
- end
71
- path_to_url(path)
72
- rescue StandardError => e
73
- raise "Put file failed: #{e}"
67
+ oss_upload_client.put_object(path, headers: headers) do |stream|
68
+ stream << file.read(CHUNK_SIZE) until file.eof?
74
69
  end
70
+ path_to_url(path)
75
71
  end
76
72
 
77
73
  def copy_object(source, dest)
@@ -94,8 +90,6 @@ module CarrierWave
94
90
  end
95
91
 
96
92
  [obj, chunk_buff.join("")]
97
- rescue StandardError => e
98
- raise "Get content faild: #{e}"
99
93
  end
100
94
 
101
95
  # 删除 Remote 的文件
@@ -109,8 +103,6 @@ module CarrierWave
109
103
  path = path.sub(PATH_PREFIX, "")
110
104
  oss_upload_client.delete_object(path)
111
105
  path_to_url(path)
112
- rescue StandardError => e
113
- raise "Delete failed: #{e}"
114
106
  end
115
107
 
116
108
  ##
@@ -2,6 +2,6 @@
2
2
 
3
3
  module CarrierWave
4
4
  module Aliyun
5
- VERSION = "1.2.2"
5
+ VERSION = "1.2.3"
6
6
  end
7
7
  end
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: 1.2.2
4
+ version: 1.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Lee
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-01-18 00:00:00.000000000 Z
11
+ date: 2021-01-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: carrierwave