添加针对中文Key的私有资源下载URL授权方法。

This commit is contained in:
Liang Tao
2014-06-30 16:08:46 +08:00
parent 2322bbcd9c
commit 31cbf3a6fd
+7
View File
@@ -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]