Uploaded image for project: 'Libcloud'
  1. Libcloud
  2. LIBCLOUD-328

Creating a container with an '@', then creating object inside container encodes url twice

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 0.12.3
    • 0.13.0
    • Storage
    • None
    • testing with cloudfiles

    Description

      Using sample code from documentation:

      container_name = 'david@statichacks.org'
      # 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)
      

      Produces a double encoded URL for the upload_object call:

      URL: david%40statichacks.org
      Created new container david@statichacks.org
      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'}
      

      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.

      Attachments

        Activity

          People

            kami Tomaz Muraus
            dbryson David Bryson
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: