Skip to content

Commit

Permalink
Merge pull request #76 from dtynn/feature/urlencode_slash
Browse files Browse the repository at this point in the history
urlencode对/进行特殊处理
  • Loading branch information
longbai committed Apr 28, 2014
2 parents 9624157 + 1a974ae commit f289aa7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion qiniu/rs.php
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}

Expand Down
6 changes: 6 additions & 0 deletions tests/RsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
}

0 comments on commit f289aa7

Please sign in to comment.