Skip to content

Commit 805b8a8

Browse files
author
Jamie Hannaford
committed
Merge pull request #389 from jamiehannaford/url-encoding
Clearer documentation for object store URL encoding
2 parents 79e1a22 + 901b8e1 commit 805b8a8

File tree

4 files changed

+18
-7
lines changed

4 files changed

+18
-7
lines changed

docs/userguide/ObjectStore/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ In the example above, you are connecting to the ``DFW`` region of the cloud. Any
4646
$container = $objectStoreService->createContainer('logos');
4747
```
4848

49+
> **Note:** when working with names that contain non-standard alphanumerical characters (such as spaces or non-English characters), you must ensure they are encoded with [`urlencode`](http://php.net/urlencode) before passing them in
50+
4951
### 4. Upload an object to the container.
5052

5153
```php
@@ -59,5 +61,5 @@ $container->uploadObject($remoteFileName, $fileData);
5961

6062
## Next steps
6163

62-
There is a lot more you can do with containers and objects. See
64+
There is a lot more you can do with containers and objects. See
6365
the [complete user guide to the Object Store service](USERGUIDE.md).

docs/userguide/ObjectStore/Storage/Container.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ If the response returned is `FALSE`, there was an API error - most likely due to
2626

2727
Container names must be valid strings between 0 and 256 characters. Forward slashes are not currently permitted.
2828

29+
> **Note:** when working with names that contain non-standard alphanumerical characters (such as spaces or non-English characters), you must ensure they are encoded with [`urlencode`](http://php.net/urlencode) before passing them in
2930
3031
## List containers
3132

docs/userguide/ObjectStore/Storage/Object.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,11 @@ setter methods:
2222

2323
There are three ways to upload a new file, each of which has different business needs.
2424

25-
__N.B__: Unlike previous versions, you do not need to manually specify your object's content type. The API will do this
25+
> **Note:** Unlike previous versions, you do not need to manually specify your object's content type. The API will do this
2626
for you.
2727

28+
> **Note:** when working with names that contain non-standard alphanumerical characters (such as spaces or non-English characters), you must ensure they are encoded with [`urlencode`](http://php.net/urlencode) before passing them in
29+
2830
### To upload a single/basic file:
2931

3032
```php
@@ -102,7 +104,8 @@ To return a list of objects:
102104

103105
```php
104106
$files = $container->objectList();
105-
while ($file = $files->next()) {
107+
108+
foreach ($files as $file) {
106109
// ... do something
107110
}
108111
```

docs/userguide/ObjectStore/USERGUIDE.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ To use the object store service, you must first instantiate a `OpenStack` or `Ra
2828
'apiKey' => '<YOUR RACKSPACE CLOUD ACCOUNT API KEY>'
2929
));
3030
```
31-
31+
3232
### Object Store Service
3333
All operations on the object store are done via an object store service object.
3434

@@ -46,7 +46,10 @@ For example, you may create a container called `logos` to hold all the image fil
4646

4747
A container may contain zero or more objects in it.
4848

49+
> **Note:** when working with names that contain non-standard alphanumerical characters (such as spaces or non-English characters), you must ensure they are encoded with [`urlencode`](http://php.net/urlencode) before passing them in
50+
4951
### Create Container
52+
5053
```php
5154
$container = $objectStoreService->createContainer('logos');
5255
```
@@ -94,7 +97,7 @@ $containerMetadata = $container->getMetadata();
9497
[ [Get the executable PHP script for this example](/samples/ObjectStore/get-container-metadata.php) ]
9598

9699
### Delete Container
97-
When you no longer have a need for the container, you can remove it.
100+
When you no longer have a need for the container, you can remove it.
98101

99102
If the container is empty (that is, it has no objects in it), you can remove it as shown below:
100103

@@ -184,6 +187,8 @@ An **object** (sometimes referred to as a file) is the unit of storage in an Obj
184187

185188
For example, you may upload an object named `php-elephant.jpg`, a JPEG image file, to the `logos` container. Further, you may assign metadata to this object to indicate that the author of this object was someone named Jane Doe.
186189

190+
> **Note:** when working with names that contain non-standard alphanumerical characters (such as spaces or non-English characters), you must ensure they are encoded with [`urlencode`](http://php.net/urlencode) before passing them in
191+
187192
### Upload Object
188193

189194
Once you have created a container, you can upload objects to it.
@@ -212,7 +217,7 @@ $metadata = array('author' => 'Jane Doe');
212217

213218
$customHeaders = array();
214219
$metadataHeaders = DataObject::stockHeaders($metadata);
215-
$allHeaders = $customHeaders + $metadataHeaders;
220+
$allHeaders = $customHeaders + $metadataHeaders;
216221

217222
$fileData = fopen($localFileName, 'r');
218223
$container->uploadObject($remoteFileName, $fileData, $allHeaders);
@@ -337,7 +342,7 @@ You can list all the objects stored in a container. An instance of `OpenCloud\Co
337342
```php
338343
$objects = $container->objectList();
339344
foreach ($objects as $object) {
340-
/** @var $object OpenCloud\ObjectStore\Resource\DataObject **/
345+
/** @var $object OpenCloud\ObjectStore\Resource\DataObject **/
341346
}
342347
```
343348
[ [Get the executable PHP script for this example](/samples/ObjectStore/list-objects.php) ]

0 commit comments

Comments
 (0)