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 +4 -4
- data/CHANGELOG.md +6 -1
- data/README.md +17 -0
- data/lib/carrierwave/aliyun/bucket.rb +3 -11
- data/lib/carrierwave/aliyun/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fd2862b19f1414efc11faf608fba6ecc0ac6a8048dd86d96cdf3ffa4b7ad3c7f
|
4
|
+
data.tar.gz: 031b8b1ad35539a5605abae8cebbb17b0b393d68cb4442d00ca1a3b2a97491c3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6d115a0e6cc1a3262a40a9f5a0a525249fef749e690d5ab7d8aeace8cb9a084881b20d6b0541833ac4c0dc0c47868b0e3805432cd31ff04044763f2b2f084160
|
7
|
+
data.tar.gz: d5c5f5ebb6567b441a73412b8670d73f6e0e9a67f867caeabdeea430d14e990e3f3ef7c5644ead6ae892c45feb891f62ed24e5766868381d056444ee6ab2f055
|
data/CHANGELOG.md
CHANGED
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
|
-
|
68
|
-
|
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
|
##
|
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.
|
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-
|
11
|
+
date: 2021-01-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: carrierwave
|