Skip to content

Commit

Permalink
Merge pull request #25 from xiaozhu36/dev
Browse files Browse the repository at this point in the history
fix param expires format bug
  • Loading branch information
dengqinsi authored Dec 5, 2018
2 parents f8f53e4 + 9c1474c commit 4513ff4
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.idea
.idea/*
*.gem
*.rbc
.bundle
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,10 @@ opt = {
conn = Fog::Storage.new(opt)
```
**-> Note:** `:aliyun_region_id` is optional and default to "cn-hangzhou".

**-> Note:** `:aliyun_oss_endpoint` is optional. If it is not specified, it will be generated automatically by `:aliyun_region_id`.
Its basic format is "oss-<region-id>.aliyuncs.com" and with default schema "http" and default port "80".
If you want to use https or 443 port, you can use a format "<schema>://oss-<region-id>.aliyuncs.com:<port>".
Its basic format is `oss-<region-id>.aliyuncs.com` and with default schema "http" and default port "80".
If you want to use https or 443 port, you can use a format `<schema>://oss-<region-id>.aliyuncs.com:<port>`.


## Fog::Aliyun Abstractions
Expand Down
3 changes: 3 additions & 0 deletions lib/fog/aliyun/models/storage/file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ def public=(new_public)
# @return [String] url
#
def url(expires, options = {})

expires = expires.nil? ? 0 : expires.to_i

requires :directory, :key
object = if directory.key == ''
key
Expand Down
2 changes: 2 additions & 0 deletions lib/fog/aliyun/models/storage/files.rb
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ def get_http_url(key, expires, options = {})
else
directory.key + '/' + key
end
expires = expires.nil? ? 0 : expires.to_i
service.get_object_http_url_public(object, expires, options)
end

Expand All @@ -143,6 +144,7 @@ def get_https_url(key, expires, options = {})
else
directory.key + '/' + key
end
expires = expires.nil? ? 0 : expires.to_i
service.get_object_https_url_public(object, expires, options)
end

Expand Down
2 changes: 1 addition & 1 deletion lib/fog/aliyun/requests/storage/get_object_http_url.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class Real
# ==== Parameters
# * container<~String> - Name of container containing object
# * object<~String> - Name of object to get expiring url for
# * expires<~Time> - An expiry time for this url
# * expires<~Integer> - An expiry time for this url
#
# ==== Returns
# * response<~Excon::Response>:
Expand Down
2 changes: 1 addition & 1 deletion lib/fog/aliyun/requests/storage/get_object_https_url.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class Real
# ==== Parameters
# * container<~String> - Name of container containing object
# * object<~String> - Name of object to get expiring url for
# * expires<~Time> - An expiry time for this url
# * expires<~Integer> - An expiry time for this url
#
# ==== Returns
# * response<~Excon::Response>:
Expand Down

0 comments on commit 4513ff4

Please sign in to comment.