commit 6d817842b9ac07b85b873b49161b651ceb966bf4
Author: Antony Chazapis <chazapis@gmail.com>
Date:   Tue Jun 14 23:00:42 2011 +0300

    Fix manifest and copy/move prefix parsing.

diff --git a/docs/source/devguide.rst b/docs/source/devguide.rst
index 27adf38..ff48bcb 100644
--- a/docs/source/devguide.rst
+++ b/docs/source/devguide.rst
@@ -294,7 +294,7 @@ content-disposition         The presentation style of the object (optional)
 last_modified               The last object modification date (regardless of version)
 x_object_version            The object's version identifier
 x_object_version_timestamp  The object's version timestamp
-x_object_manifest           Large object support (optional)
+x_object_manifest           Object parts prefix in ``<container>/<object>`` form (optional)
 x_object_public             Object is publicly accessible (optional)
 x_object_meta_*             Optional user defined metadata
 ==========================  ======================================
@@ -412,7 +412,7 @@ Content-Encoding            The encoding of the object (optional)
 Content-Disposition         The presentation style of the object (optional)
 X-Object-Version            The object's version identifier
 X-Object-Version-Timestamp  The object's version timestamp
-X-Object-Manifest           Large object support (optional)
+X-Object-Manifest           Object parts prefix in ``<container>/<object>`` form (optional)
 X-Object-Public             Object is publicly accessible (optional)
 X-Object-Meta-*             Optional user defined metadata
 ==========================  ===============================
@@ -501,7 +501,7 @@ Content-Encoding            The encoding of the object (optional)
 Content-Disposition         The presentation style of the object (optional)
 X-Object-Version            The object's version identifier
 X-Object-Version-Timestamp  The object's version timestamp
-X-Object-Manifest           Large object support (optional)
+X-Object-Manifest           Object parts prefix in ``<container>/<object>`` form (optional)
 X-Object-Public             Object is publicly accessible (optional)
 X-Object-Meta-*             Optional user defined metadata
 ==========================  ===============================
@@ -534,7 +534,7 @@ X-Move-From           The source path in the form ``/<container>/<object>``
 X-Source-Version      The source version to copy/move from
 Content-Encoding      The encoding of the object (optional)
 Content-Disposition   The presentation style of the object (optional)
-X-Object-Manifest     Large object support (optional)
+X-Object-Manifest     Object parts prefix in ``<container>/<object>`` form (optional)
 X-Object-Public       Object is publicly accessible (optional)
 X-Object-Meta-*       Optional user defined metadata
 ====================  ================================
@@ -569,7 +569,7 @@ Content-Type          The MIME content type of the object (optional)
 Content-Encoding      The encoding of the object (optional)
 Content-Disposition   The presentation style of the object (optional)
 X-Source-Version      The source version to copy/move from
-X-Object-Manifest     Large object support (optional)
+X-Object-Manifest     Object parts prefix in ``<container>/<object>`` form (optional)
 X-Object-Public       Object is publicly accessible (optional)
 X-Object-Meta-*       Optional user defined metadata
 ====================  ================================
@@ -601,7 +601,7 @@ Content-Range         The range of data supplied (optional, to update)
 Transfer-Encoding     Set to ``chunked`` to specify incremental uploading (if used, ``Content-Length`` is ignored)
 Content-Encoding      The encoding of the object (optional)
 Content-Disposition   The presentation style of the object (optional)
-X-Object-Manifest     Large object support (optional)
+X-Object-Manifest     Object parts prefix in ``<container>/<object>`` form (optional)
 X-Object-Public       Object is publicly accessible (optional)
 X-Object-Meta-*       Optional user defined metadata
 ====================  ================================
diff --git a/pithos/api/functions.py b/pithos/api/functions.py
index 862f208..b0f5a2f 100644
--- a/pithos/api/functions.py
+++ b/pithos/api/functions.py
@@ -432,7 +432,7 @@ def object_read(request, v_account, v_container, v_object):
     hashmaps = []
     if 'X-Object-Manifest' in meta:
         try:
-            src_container, src_name = split_container_object_string(meta['X-Object-Manifest'])
+            src_container, src_name = split_container_object_string('/' + meta['X-Object-Manifest'])
             objects = backend.list_objects(request.user, v_account, src_container, prefix=src_name, virtual=False)
         except ValueError:
             raise BadRequest('Invalid X-Object-Manifest header')
diff --git a/pithos/api/util.py b/pithos/api/util.py
index 93f3c1e..f41e36c 100644
--- a/pithos/api/util.py
+++ b/pithos/api/util.py
@@ -160,7 +160,7 @@ def update_manifest_meta(request, v_account, meta):
         hash = ''
         bytes = 0
         try:
-            src_container, src_name = split_container_object_string(meta['X-Object-Manifest'])
+            src_container, src_name = split_container_object_string('/' + meta['X-Object-Manifest'])
             objects = backend.list_objects(request.user, v_account, src_container, prefix=src_name, virtual=False)
             for x in objects:
                 src_meta = backend.get_object_meta(request.user, v_account, src_container, x[0], x[1])
@@ -209,6 +209,9 @@ def validate_matching_preconditions(request, meta):
             raise NotModified('Resource Etag matches')
 
 def split_container_object_string(s):
+    if not len(s) > 0 or s[0] != '/':
+        raise ValueError
+    s = s[1:]
     pos = s.find('/')
     if pos == -1:
         raise ValueError
diff --git a/pithos/backends/simple.py b/pithos/backends/simple.py
index 7f15221..e1ff13c 100644
--- a/pithos/backends/simple.py
+++ b/pithos/backends/simple.py
@@ -259,6 +259,7 @@ class SimpleBackend(BaseBackend):
         """Copy an object's data and metadata."""
         
         logger.debug("copy_object: %s %s %s %s %s %s %s %s", account, src_container, src_name, dest_container, dest_name, dest_meta, replace_meta, src_version)
+        self._get_containerinfo(account, src_container)
         if src_version is None:
             src_path = self._get_objectinfo(account, src_container, src_name)[0]
         else:
diff --git a/pithos/public/functions.py b/pithos/public/functions.py
index fb5242e..983612a 100644
--- a/pithos/public/functions.py
+++ b/pithos/public/functions.py
@@ -109,7 +109,7 @@ def object_read(request, v_account, v_container, v_object):
     hashmaps = []
     if 'X-Object-Manifest' in meta:
         try:
-            src_container, src_name = split_container_object_string(meta['X-Object-Manifest'])
+            src_container, src_name = split_container_object_string('/' + meta['X-Object-Manifest'])
             objects = backend.list_objects(request.user, v_account, src_container, prefix=src_name, virtual=False)
         except ValueError:
             raise ItemNotFound('Object does not exist')
