Skip to content

Commit 4513ff4

Browse files
authored
Merge pull request #25 from xiaozhu36/dev
fix param expires format bug
2 parents f8f53e4 + 9c1474c commit 4513ff4

File tree

6 files changed

+12
-4
lines changed

6 files changed

+12
-4
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
.idea
2+
.idea/*
13
*.gem
24
*.rbc
35
.bundle

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,10 @@ opt = {
5353
conn = Fog::Storage.new(opt)
5454
```
5555
**-> Note:** `:aliyun_region_id` is optional and default to "cn-hangzhou".
56+
5657
**-> Note:** `:aliyun_oss_endpoint` is optional. If it is not specified, it will be generated automatically by `:aliyun_region_id`.
57-
Its basic format is "oss-<region-id>.aliyuncs.com" and with default schema "http" and default port "80".
58-
If you want to use https or 443 port, you can use a format "<schema>://oss-<region-id>.aliyuncs.com:<port>".
58+
Its basic format is `oss-<region-id>.aliyuncs.com` and with default schema "http" and default port "80".
59+
If you want to use https or 443 port, you can use a format `<schema>://oss-<region-id>.aliyuncs.com:<port>`.
5960

6061

6162
## Fog::Aliyun Abstractions

lib/fog/aliyun/models/storage/file.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ def public=(new_public)
8787
# @return [String] url
8888
#
8989
def url(expires, options = {})
90+
91+
expires = expires.nil? ? 0 : expires.to_i
92+
9093
requires :directory, :key
9194
object = if directory.key == ''
9295
key

lib/fog/aliyun/models/storage/files.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ def get_http_url(key, expires, options = {})
133133
else
134134
directory.key + '/' + key
135135
end
136+
expires = expires.nil? ? 0 : expires.to_i
136137
service.get_object_http_url_public(object, expires, options)
137138
end
138139

@@ -143,6 +144,7 @@ def get_https_url(key, expires, options = {})
143144
else
144145
directory.key + '/' + key
145146
end
147+
expires = expires.nil? ? 0 : expires.to_i
146148
service.get_object_https_url_public(object, expires, options)
147149
end
148150

lib/fog/aliyun/requests/storage/get_object_http_url.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class Real
99
# ==== Parameters
1010
# * container<~String> - Name of container containing object
1111
# * object<~String> - Name of object to get expiring url for
12-
# * expires<~Time> - An expiry time for this url
12+
# * expires<~Integer> - An expiry time for this url
1313
#
1414
# ==== Returns
1515
# * response<~Excon::Response>:

lib/fog/aliyun/requests/storage/get_object_https_url.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class Real
99
# ==== Parameters
1010
# * container<~String> - Name of container containing object
1111
# * object<~String> - Name of object to get expiring url for
12-
# * expires<~Time> - An expiry time for this url
12+
# * expires<~Integer> - An expiry time for this url
1313
#
1414
# ==== Returns
1515
# * response<~Excon::Response>:

0 commit comments

Comments
 (0)