You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by to...@apache.org on 2013/07/23 20:45:25 UTC

[1/2] git commit: Fix a regression with calling encode_container_name instead of encode_object_name on object name in get_object method.

Updated Branches:
  refs/heads/0.13.x 2fe10abfd -> 272d80a1e
  refs/heads/trunk 67d60d021 -> 384b574e4


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/384b574e
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/384b574e
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/384b574e

Branch: refs/heads/trunk
Commit: 384b574e4f63af4be877b7cb0cc906187dc0bc24
Parents: 67d60d0
Author: Tomaz Muraus <to...@apache.org>
Authored: Tue Jul 23 20:39:16 2013 +0200
Committer: Tomaz Muraus <to...@apache.org>
Committed: Tue Jul 23 20:39:16 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/384b574e/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 4856e51..c7367d3 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/384b574e/libcloud/storage/drivers/cloudfiles.py
----------------------------------------------------------------------
diff --git a/libcloud/storage/drivers/cloudfiles.py b/libcloud/storage/drivers/cloudfiles.py
index 8e51e59..db38669 100644
--- a/libcloud/storage/drivers/cloudfiles.py
+++ b/libcloud/storage/drivers/cloudfiles.py
@@ -252,7 +252,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/384b574e/libcloud/test/storage/test_cloudfiles.py
----------------------------------------------------------------------
diff --git a/libcloud/test/storage/test_cloudfiles.py b/libcloud/test/storage/test_cloudfiles.py
index 1fd5f06..524d549 100644
--- a/libcloud/test/storage/test_cloudfiles.py
+++ b/libcloud/test/storage/test_cloudfiles.py
@@ -226,6 +226,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',
@@ -894,6 +899,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


[2/2] git commit: Fix a regression with calling encode_container_name instead of encode_object_name on object name in get_object method.

Posted by to...@apache.org.
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 <to...@apache.org>
Authored: Tue Jul 23 20:39:16 2013 +0200
Committer: Tomaz Muraus <to...@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