[ 
https://issues.apache.org/jira/browse/LIBCLOUD-328?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13665559#comment-13665559
 ] 

ASF subversion and git services commented on LIBCLOUD-328:
----------------------------------------------------------

Commit 1485839 from [~kami]
[ https://svn.apache.org/r1485839 ]

Fix an issue with double encoding the container name in the CloudFiles
driver upload_object method.

Also properly encode container and object name used in the HTTP request
in the get_container and get_object method. For clarity rename current
 _clean* methods to _encode*.

Fixes LIBCLOUD-328.
                
> Creating a container with an '@', then creating object inside container 
> encodes url twice
> -----------------------------------------------------------------------------------------
>
>                 Key: LIBCLOUD-328
>                 URL: https://issues.apache.org/jira/browse/LIBCLOUD-328
>             Project: Libcloud
>          Issue Type: Bug
>          Components: Storage
>    Affects Versions: 0.12.3
>         Environment: testing with cloudfiles
>            Reporter: David Bryson
>            Priority: Minor
>             Fix For: 0.12.3
>
>
> Using sample code from documentation:
> {code}
> container_name = '[email protected]'
> # Create a container if it doesn't already exist
> try:
>     container = driver.get_container(container_name=container_name)
>     print "Using existing container %s" % container_name
> except ContainerDoesNotExistError:
>     container = driver.create_container(container_name=container_name)
>     print "Created new container %s" % container_name
> print 'Uploading object...'
> content = { 'content_type' : 'audio' }
> # Compress data in our directory and stream it directly to CF
> obj = container.upload_object(file_name, object_name=object_name,
>                 extra=content)
> {code}
> Produces a double encoded URL for the upload_object call:
> {noformat}
> URL: david%40statichacks.org
> Created new container [email protected]
> Uploading object...
> URL: david%2540statichacks.org
> {'bytes_transferred': 4269,
>  'data_hash': 'eb80d68c737781db10b748fd53ecdd22',
>  'response': <libcloud.storage.drivers.cloudfiles.CloudFilesRawResponse 
> object at 0x25d1310>}
> 404
> {'date': 'Wed, 22 May 2013 15:06:58 GMT', 'content-length': '70', 
> 'content-type': 'text/html; charset=UTF-8', 'x-trans-id': 
> 'txa6557bd13bb14d1895154d4b36049a55'}
> {noformat}
> I can avoid this by overwriting the container object in the above code with 
> another 'get_container' call.  But it seems like the code should just do the 
> right thing when an object uploaded using an existing container.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to