From 31cbf3a6fd7a133e89d5992ec9af83434cf17ee3 Mon Sep 17 00:00:00 2001 From: Liang Tao Date: Mon, 30 Jun 2014 16:08:46 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=92=88=E5=AF=B9=E4=B8=AD?= =?UTF-8?q?=E6=96=87Key=E7=9A=84=E7=A7=81=E6=9C=89=E8=B5=84=E6=BA=90?= =?UTF-8?q?=E4=B8=8B=E8=BD=BDURL=E6=8E=88=E6=9D=83=E6=96=B9=E6=B3=95?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/qiniu/auth.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/qiniu/auth.rb b/lib/qiniu/auth.rb index 5a2a5f3..3d028ca 100755 --- a/lib/qiniu/auth.rb +++ b/lib/qiniu/auth.rb @@ -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]