libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject [2/2] git commit: Fix a regression with calling encode_container_name instead of encode_object_name on object name in get_object method.
Date Tue, 23 Jul 2013 18:45:26 GMT
Fix a regression with calling encode_container_name instead of
 encode_object_name on object name in get_object method.

Reported by Ben Meng, part of LIBCLOUD-366.


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/272d80a1
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/272d80a1
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/272d80a1

Branch: refs/heads/0.13.x
Commit: 272d80a1ee6b3b8458903036f7b7550f9e9845f8
Parents: 2fe10ab
Author: Tomaz Muraus <tomaz@apache.org>
Authored: Tue Jul 23 20:39:16 2013 +0200
Committer: Tomaz Muraus <tomaz@apache.org>
Committed: Tue Jul 23 20:39:56 2013 +0200

----------------------------------------------------------------------
 CHANGES                                  |  7 +++++++
 libcloud/storage/drivers/cloudfiles.py   |  2 +-
 libcloud/test/storage/test_cloudfiles.py | 21 +++++++++++++++++++++
 3 files changed, 29 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/272d80a1/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 41b589a..a308d8b 100644
--- a/CHANGES
+++ b/CHANGES
@@ -22,6 +22,13 @@ Changes with Apache Libcloud in development
     - Add Ubuntu Linux 12.04 image to ElasticHosts driver. (LIBCLOUD-364)
       [Bob Thompson]
 
+  *) Storage
+
+    - Fix a regression with calling encode_container_name instead of
+      encode_object_name on object name in get_object method.
+      Reported by Ben Meng (LIBCLOUD-366)
+      [Tomaz Muraus]
+
 Changes with Apache Libcloud 0.13.0:
 
  *) General

http://git-wip-us.apache.org/repos/asf/libcloud/blob/272d80a1/libcloud/storage/drivers/cloudfiles.py
----------------------------------------------------------------------
diff --git a/libcloud/storage/drivers/cloudfiles.py b/libcloud/storage/drivers/cloudfiles.py
index d3fddc8..7e810b6 100644
--- a/libcloud/storage/drivers/cloudfiles.py
+++ b/libcloud/storage/drivers/cloudfiles.py
@@ -260,7 +260,7 @@ class CloudFilesStorageDriver(StorageDriver, OpenStackDriverMixin):
     def get_object(self, container_name, object_name):
         container = self.get_container(container_name)
         container_name_encoded = self._encode_container_name(container_name)
-        object_name_encoded = self._encode_container_name(object_name)
+        object_name_encoded = self._encode_object_name(object_name)
 
         response = self.connection.request('/%s/%s' % (container_name_encoded,
                                                        object_name_encoded),

http://git-wip-us.apache.org/repos/asf/libcloud/blob/272d80a1/libcloud/test/storage/test_cloudfiles.py
----------------------------------------------------------------------
diff --git a/libcloud/test/storage/test_cloudfiles.py b/libcloud/test/storage/test_cloudfiles.py
index e0390b5..b70be4f 100644
--- a/libcloud/test/storage/test_cloudfiles.py
+++ b/libcloud/test/storage/test_cloudfiles.py
@@ -201,6 +201,11 @@ class CloudFilesTests(unittest.TestCase):
         self.assertEqual(obj.meta_data['foo-bar'], 'test 1')
         self.assertEqual(obj.meta_data['bar-foo'], 'test 2')
 
+    def test_get_object_object_name_encoding(self):
+        obj = self.driver.get_object(container_name='test_container',
+                                     object_name='~/test_object/')
+        self.assertEqual(obj.name, '~/test_object/')
+
     def test_get_object_not_found(self):
         try:
             self.driver.get_object(container_name='test_container',
@@ -839,6 +844,22 @@ class CloudFilesMockHttp(StorageMockHttp, MockHttpTestCase):
                              'content-type': 'application/zip'})
         return (status_code, body, headers, httplib.responses[httplib.OK])
 
+    def _v1_MossoCloudFS_test_container__7E_test_object(
+        self, method, url, body, headers):
+        headers = copy.deepcopy(self.base_headers)
+        if method == 'HEAD':
+            # get_object_name_encoding
+            body = self.fixtures.load('list_container_objects_empty.json')
+            status_code = httplib.NO_CONTENT
+            headers.update({ 'content-length': 555,
+                             'last-modified': 'Tue, 25 Jan 2011 22:01:49 GMT',
+                             'etag': '6b21c4a111ac178feacf9ec9d0c71f17',
+                             'x-object-meta-foo-bar': 'test 1',
+                             'x-object-meta-bar-foo': 'test 2',
+                             'content-type': 'application/zip'})
+        return (status_code, body, headers, httplib.responses[httplib.OK])
+
+
     def _v1_MossoCloudFS_test_create_container(
         self, method, url, body, headers):
         # test_create_container_success


Mime
View raw message