Skip to content

Commit f289aa7

Browse files
committed
Merge pull request #76 from dtynn/feature/urlencode_slash
urlencode对/进行特殊处理
2 parents 9624157 + 1a974ae commit f289aa7

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

qiniu/rs.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function MakeRequest($baseUrl, $mac) // => $privateUrl
3232

3333
function Qiniu_RS_MakeBaseUrl($domain, $key) // => $baseUrl
3434
{
35-
$keyEsc = rawurlencode($key);
35+
$keyEsc = str_replace("%2F", "/", rawurlencode($key));
3636
return "http://$domain/$keyEsc";
3737
}
3838

tests/RsTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,5 +88,11 @@ public function testBatchDeleteMoveCopy()
8888

8989
Qiniu_RS_BatchDelete($this->client, array($e2, $e3, $e4));
9090
}
91+
92+
public function testUrlEncode() {
93+
$url = Qiniu_RS_MakeBaseUrl("www.qiniu.com", "a/b/c d");
94+
var_dump($url);
95+
$this->assertEquals($url, "http://www.qiniu.com/a/b/c%20d");
96+
}
9197
}
9298

0 commit comments

Comments
 (0)