[ARVADOS] updated: 1.2.0-304-g1ae309b0d

Git user git at public.curoverse.com
Tue Nov 6 09:16:50 EST 2018


Summary of changes:
 sdk/python/arvados/collection.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

       via  1ae309b0d7449dd9fed18ffe6187279235d852c8 (commit)
      from  f84ad3d4756122788f76826d76d5dd035b5dfc65 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 1ae309b0d7449dd9fed18ffe6187279235d852c8
Author: Tom Clegg <tclegg at veritasgenetics.com>
Date:   Mon Nov 5 16:46:50 2018 -0500

    14345: Unescape all \ooo in names in manifests, not just \040.
    
    Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tclegg at veritasgenetics.com>

diff --git a/sdk/python/arvados/collection.py b/sdk/python/arvados/collection.py
index 55797bdfe..d354b9f7b 100644
--- a/sdk/python/arvados/collection.py
+++ b/sdk/python/arvados/collection.py
@@ -1667,6 +1667,9 @@ class Collection(RichCollectionBase):
     _block_re = re.compile(r'[0-9a-f]{32}\+(\d+)(\+\S+)*')
     _segment_re = re.compile(r'(\d+):(\d+):(\S+)')
 
+    def _unescape_manifest_path(self, path):
+        return re.sub('\\([0-3][0-7][0-7]|\\)', path, lambda m: '\\' if m=='\\' else chr(int(m[1], 8)))
+
     @synchronized
     def _import_manifest(self, manifest_text):
         """Import a manifest into a `Collection`.
@@ -1691,7 +1694,7 @@ class Collection(RichCollectionBase):
 
             if state == STREAM_NAME:
                 # starting a new stream
-                stream_name = tok.replace('\\040', ' ')
+                stream_name = self._unescape_manifest_path(tok)
                 blocks = []
                 segments = []
                 streamoffset = 0
@@ -1713,7 +1716,7 @@ class Collection(RichCollectionBase):
                 if file_segment:
                     pos = int(file_segment.group(1))
                     size = int(file_segment.group(2))
-                    name = file_segment.group(3).replace('\\040', ' ')
+                    name = self._unescape_manifest_path(file_segment.group(3))
                     filepath = os.path.join(stream_name, name)
                     afile = self.find_or_create(filepath, FILE)
                     if isinstance(afile, ArvadosFile):

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list