mirror of
https://github.com/wahyd4/ruby-sdk.git
synced 2026-08-09 04:46:10 +10:00
添加针对中文Key的私有资源下载URL授权方法。
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
|
||||
require 'hmac-sha1'
|
||||
require 'uri'
|
||||
require 'cgi'
|
||||
|
||||
require 'qiniu/exceptions'
|
||||
|
||||
@@ -175,6 +176,12 @@ module Qiniu
|
||||
return "#{download_url}&token=#{dntoken}"
|
||||
end # authorize_download_url
|
||||
|
||||
def authorize_download_url_2(domain, key, args = EMPTY_ARGS)
|
||||
url_encoded_key = key.split('/').map{|x| CGI::escape(x)}.join("/")
|
||||
download_url = "http://#{domain}/#{url_encoded_key}"
|
||||
return authorize_download_url(download_url, args)
|
||||
end # authorize_download_url_2
|
||||
|
||||
def generate_acctoken(url, body = '')
|
||||
### 提取AK/SK信息
|
||||
access_key = Config.settings[:access_key]
|
||||
|
||||
Reference in New Issue
Block a user