fog-aliyun 0.3.6 → 0.3.7
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 71f324e607c567e9377a324698f35edd82667312c28fce1d3d8dc2e7e771af19
|
4
|
+
data.tar.gz: 608ea19f6289e5fc3e6ab8642f1326b7b88cb81639853b91f98be251923633e5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 80f63cc617a5e1d1758955342ae252c94e89dbb429575ad8da406100d3dd56a446dd34cbfa896be2c8908e7fd118e7cfb6e87f648def81a52b812c1f72832be8
|
7
|
+
data.tar.gz: 1da3cd3a1a3d8bc19d2290fdce54f2e9efe1e26849a93a8a5a2b7310f3303c46e1550d0e445cd316b1a7a8fdd5c39f2a07f79a19351e3857b02bd6cf117df37d
|
@@ -31,13 +31,16 @@ module Fog
|
|
31
31
|
# If key does not contain /, if bucket, return '', else return an existed or a new one directory;
|
32
32
|
def get(key, options = {})
|
33
33
|
if !key.nil? && key != '' && key != '.'
|
34
|
+
key = key.chomp('/')
|
34
35
|
if key.include? '/'
|
35
36
|
dir = key + '/'
|
36
37
|
ret = service.head_object(dir, options)
|
37
38
|
new(key: key) if ret.data[:status] == 200
|
38
39
|
else
|
39
40
|
data = service.get_bucket(key)
|
40
|
-
|
41
|
+
puts "[DEBUG] Getting the bucket named with #{key}..."
|
42
|
+
puts data
|
43
|
+
if data.class == Hash && data.key?('Code') && !data['Code'].nil? && !data['Code'].empty?
|
41
44
|
dir = key + '/'
|
42
45
|
ret = service.head_object(dir, options)
|
43
46
|
new(key: key) if ret.data[:status] == 200
|
@@ -6,10 +6,18 @@ module Fog
|
|
6
6
|
class Real
|
7
7
|
def get_bucket(bucket)
|
8
8
|
location = get_bucket_location(bucket)
|
9
|
+
# If there is an error, it will return a Hash with error code, host id and others
|
10
|
+
# If can not get a valid location, will return one using region
|
11
|
+
if location.class == Hash && location.key?('HostId')
|
12
|
+
value = location['HostId']
|
13
|
+
location = value[0].split('.')[1]
|
14
|
+
else
|
15
|
+
location = 'oss-' + @aliyun_region_id
|
16
|
+
end
|
9
17
|
endpoint = 'http://' + location + '.aliyuncs.com'
|
10
18
|
resource = bucket + '/'
|
11
19
|
ret = request(
|
12
|
-
expects: [200, 203],
|
20
|
+
expects: [200, 203, 404],
|
13
21
|
method: 'GET',
|
14
22
|
bucket: bucket,
|
15
23
|
resource: resource,
|
@@ -23,7 +31,7 @@ module Fog
|
|
23
31
|
attribute = '?location'
|
24
32
|
resource = bucket + '/' + attribute
|
25
33
|
ret = request(
|
26
|
-
expects: [200, 203],
|
34
|
+
expects: [200, 203, 403, 404],
|
27
35
|
method: 'GET',
|
28
36
|
path: attribute,
|
29
37
|
bucket: bucket,
|
data/lib/fog/aliyun/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fog-aliyun
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Qinsi Deng, Jianxun Li, Jane Han
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-03-
|
11
|
+
date: 2020-03-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|