From 1a974ae664dbf576fc20ae46bffe9b5afba90a57 Mon Sep 17 00:00:00 2001 From: dtynn Date: Mon, 28 Apr 2014 17:34:43 +0800 Subject: [PATCH] =?UTF-8?q?urlencode=E5=AF=B9/=E8=BF=9B=E8=A1=8C=E7=89=B9?= =?UTF-8?q?=E6=AE=8A=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- qiniu/rs.php | 2 +- tests/RsTest.php | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/qiniu/rs.php b/qiniu/rs.php index 1166b5d8..d2a94125 100644 --- a/qiniu/rs.php +++ b/qiniu/rs.php @@ -32,7 +32,7 @@ public function MakeRequest($baseUrl, $mac) // => $privateUrl function Qiniu_RS_MakeBaseUrl($domain, $key) // => $baseUrl { - $keyEsc = rawurlencode($key); + $keyEsc = str_replace("%2F", "/", rawurlencode($key)); return "http://$domain/$keyEsc"; } diff --git a/tests/RsTest.php b/tests/RsTest.php index 2368198c..b02375a2 100644 --- a/tests/RsTest.php +++ b/tests/RsTest.php @@ -88,5 +88,11 @@ public function testBatchDeleteMoveCopy() Qiniu_RS_BatchDelete($this->client, array($e2, $e3, $e4)); } + + public function testUrlEncode() { + $url = Qiniu_RS_MakeBaseUrl("www.qiniu.com", "a/b/c d"); + var_dump($url); + $this->assertEquals($url, "http://www.qiniu.com/a/b/c%20d"); + } }