DEVEX-2162: Replace urlencode() with rawurlencode().
This commit is contained in:
@@ -487,7 +487,7 @@ class CDN {
|
||||
* The expected HTTP code.
|
||||
*/
|
||||
protected function modifyContainer($name, $method, $headers = array(), $qstring = '') {
|
||||
$url = $this->url . '/' . urlencode($name) . $qstring;
|
||||
$url = $this->url . '/' . rawurlencode($name) . $qstring;
|
||||
$headers['X-Auth-Token'] = $this->token;
|
||||
|
||||
$client = \HPCloud\Transport::instance();
|
||||
|
||||
@@ -280,7 +280,7 @@ class ObjectStorage {
|
||||
*/
|
||||
public function container($name) {
|
||||
|
||||
$url = $this->url() . '/' . urlencode($name);
|
||||
$url = $this->url() . '/' . rawurlencode($name);
|
||||
$data = $this->req($url, 'HEAD', FALSE);
|
||||
|
||||
$status = $data->status();
|
||||
@@ -379,7 +379,7 @@ class ObjectStorage {
|
||||
* created because it already exists.
|
||||
*/
|
||||
public function createContainer($name, ACL $acl = NULL, $metadata = array()) {
|
||||
$url = $this->url() . '/' . urlencode($name);
|
||||
$url = $this->url() . '/' . rawurlencode($name);
|
||||
$headers = array(
|
||||
'X-Auth-Token' => $this->token(),
|
||||
);
|
||||
@@ -469,7 +469,7 @@ class ObjectStorage {
|
||||
* results in a non-standard code.
|
||||
*/
|
||||
public function deleteContainer($name) {
|
||||
$url = $this->url() . '/' . urlencode($name);
|
||||
$url = $this->url() . '/' . rawurlencode($name);
|
||||
|
||||
try {
|
||||
$data = $this->req($url, 'DELETE', FALSE);
|
||||
|
||||
@@ -127,7 +127,7 @@ class Container implements \Countable, \IteratorAggregate {
|
||||
$oParts = explode('/', $oname);
|
||||
$buffer = array();
|
||||
foreach ($oParts as $part) {
|
||||
$buffer[] = urlencode($part);
|
||||
$buffer[] = rawurlencode($part);
|
||||
}
|
||||
$newname = implode('/', $buffer);
|
||||
return $base . '/' . $newname;
|
||||
@@ -190,7 +190,7 @@ class Container implements \Countable, \IteratorAggregate {
|
||||
|
||||
$container->baseUrl = $url;
|
||||
|
||||
$container->url = $url . '/' . urlencode($jsonArray['name']);
|
||||
$container->url = $url . '/' . rawurlencode($jsonArray['name']);
|
||||
$container->token = $token;
|
||||
|
||||
// Access to count and bytes is basically controlled. This is is to
|
||||
@@ -233,7 +233,7 @@ class Container implements \Countable, \IteratorAggregate {
|
||||
$container->bytes = $response->header('X-Container-Bytes-Used', 0);
|
||||
$container->count = $response->header('X-Container-Object-Count', 0);
|
||||
$container->baseUrl = $url;
|
||||
$container->url = $url . '/' . urlencode($name);
|
||||
$container->url = $url . '/' . rawurlencode($name);
|
||||
$container->token = $token;
|
||||
|
||||
$container->acl = ACL::newFromHeaders($response->headers());
|
||||
@@ -396,7 +396,7 @@ class Container implements \Countable, \IteratorAggregate {
|
||||
throw new \HPCloud\Exception('Container does not have a URL to send data.');
|
||||
}
|
||||
|
||||
//$url = $this->url . '/' . urlencode($obj->name());
|
||||
//$url = $this->url . '/' . rawurlencode($obj->name());
|
||||
$url = self::objectUrl($this->url, $obj->name());
|
||||
|
||||
// See if we have any metadata.
|
||||
@@ -414,7 +414,7 @@ class Container implements \Countable, \IteratorAggregate {
|
||||
// Add content encoding, if necessary.
|
||||
$encoding = $obj->encoding();
|
||||
if (!empty($encoding)) {
|
||||
$headers['Content-Encoding'] = urlencode($encoding);
|
||||
$headers['Content-Encoding'] = rawurlencode($encoding);
|
||||
}
|
||||
|
||||
// Add content disposition, if necessary.
|
||||
@@ -500,7 +500,7 @@ class Container implements \Countable, \IteratorAggregate {
|
||||
* if the object does not already exist on the object storage.
|
||||
*/
|
||||
public function updateMetadata(Object $obj) {
|
||||
//$url = $this->url . '/' . urlencode($obj->name());
|
||||
//$url = $this->url . '/' . rawurlencode($obj->name());
|
||||
$url = self::objectUrl($this->url, $obj->name());
|
||||
$headers = array();
|
||||
|
||||
@@ -566,7 +566,7 @@ class Container implements \Countable, \IteratorAggregate {
|
||||
if (empty($container)) {
|
||||
$container = $this->name;
|
||||
}
|
||||
$container = urlencode($container);
|
||||
$container = rawurlencode($container);
|
||||
$destUrl = self::objectUrl('/' . $container, $newName);
|
||||
|
||||
$headers = array(
|
||||
@@ -928,7 +928,7 @@ class Container implements \Countable, \IteratorAggregate {
|
||||
throw new \HPCloud\Exception('Unexpected entity returned.');
|
||||
}
|
||||
else {
|
||||
//$url = $this->url . '/' . urlencode($item['name']);
|
||||
//$url = $this->url . '/' . rawurlencode($item['name']);
|
||||
$url = self::objectUrl($this->url, $item['name']);
|
||||
$list[] = RemoteObject::newFromJSON($item, $this->token, $url);
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ use \HPCloud\Storage\ObjectStorage;
|
||||
* `path/like/file/name.txt`.
|
||||
*
|
||||
* A note on UTF-8 and URLs: PHP does not yet natively support many UTF-8
|
||||
* characters in URLs. Thus, you ought to urlencode() your container name
|
||||
* characters in URLs. Thus, you ought to rawurlencode() your container name
|
||||
* and object name (path) if there is any possibility that it will contain
|
||||
* UTF-8 characters.
|
||||
*
|
||||
@@ -1037,7 +1037,7 @@ class StreamWrapper {
|
||||
// $container = $this->store->container($url['host']);
|
||||
$name = $url['host'];
|
||||
$token = $this->store->token();
|
||||
$endpoint_url = $this->store->url() . '/' . urlencode($name);
|
||||
$endpoint_url = $this->store->url() . '/' . rawurlencode($name);
|
||||
$container = new \HPCloud\Storage\ObjectStorage\Container($name, $endpoint_url, $token);
|
||||
return $container->delete($url['path']);
|
||||
}
|
||||
@@ -1070,7 +1070,7 @@ class StreamWrapper {
|
||||
//$container = $this->store->container($url['host']);
|
||||
$name = $url['host'];
|
||||
$token = $this->store->token();
|
||||
$endpoint_url = $this->store->url() . '/' . urlencode($name);
|
||||
$endpoint_url = $this->store->url() . '/' . rawurlencode($name);
|
||||
$container = new \HPCloud\Storage\ObjectStorage\Container($name, $endpoint_url, $token);
|
||||
$obj = $container->remoteObject($url['path']);
|
||||
}
|
||||
@@ -1329,7 +1329,7 @@ class StreamWrapper {
|
||||
* Parse a URL.
|
||||
*
|
||||
* In order to provide full UTF-8 support, URLs must be
|
||||
* urlencoded before they are passed into the stream wrapper.
|
||||
* rawurlencoded before they are passed into the stream wrapper.
|
||||
*
|
||||
* This parses the URL and urldecodes the container name and
|
||||
* the object name.
|
||||
|
||||
Reference in New Issue
Block a user