shrine-aliyun-oss 0.1.0.beta1 → 0.1.0.beta2
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/lib/shrine/storage/aliyun_oss.rb +4 -2
- data/shrine-aliyun-oss.gemspec +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: a8c9db93e086cf7c9e0d7998130511298bc17254a8c2677c807910ed99c39d61
|
4
|
+
data.tar.gz: ff5506965d0ad3a0a104e47a4bf72f7381f83d7c7658c47acbd8722c64297640
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0d1099ec40b115eec4c7635fe82036cbef1aafee53f131b7dc531439ea6bc2211301b3504ef06b022296345a4e7e956e33bebbbea59a124e9334418a4a0c3416
|
7
|
+
data.tar.gz: 76f4f9f0f77bc13b511d4cdfa5b3d07ca9bcf51dde861ffdf7395bc3a4a184b398569c2b525bac1fc353fe242396a2f0cb717ae578af2902fc68e7c98dcd2e3e
|
@@ -13,10 +13,12 @@ class Shrine
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def upload(io, id, shrine_metadata: {}, **upload_options)
|
16
|
+
content_type = shrine_metadata["mime_type"]
|
17
|
+
|
16
18
|
if copyable?(io)
|
17
19
|
bucket.copy_object(io.storage.object_key(io.id), object_key(id))
|
18
20
|
else
|
19
|
-
bucket.put_object(object_key(id)) { |stream| stream << io.read }
|
21
|
+
bucket.put_object(object_key(id), content_type: content_type) { |stream| stream << io.read }
|
20
22
|
end
|
21
23
|
end
|
22
24
|
|
@@ -27,7 +29,7 @@ class Shrine
|
|
27
29
|
# Downloads the file from Aliyun OSS, and returns a `Tempfile`.
|
28
30
|
def download(id)
|
29
31
|
tempfile = Tempfile.new(["shrine-aliyun-oss", File.extname(id)], binmode: true)
|
30
|
-
object = bucket.get_object(id, file: tempfile)
|
32
|
+
object = bucket.get_object(object_key(id), file: tempfile)
|
31
33
|
|
32
34
|
tempfile.singleton_class.instance_eval { attr_accessor :content_type }
|
33
35
|
tempfile.content_type = object.headers[:content_type]
|
data/shrine-aliyun-oss.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shrine-aliyun-oss
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.0.
|
4
|
+
version: 0.1.0.beta2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Derrick Zhang
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-02-
|
11
|
+
date: 2018-02-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: shrine
|