[ARVADOS] updated: 1.3.0-155-g8b2eb7d1f
Git user
git at public.curoverse.com
Wed Jan 16 16:34:41 EST 2019
Summary of changes:
sdk/python/arvados/_normalize_stream.py | 13 +++++--------
sdk/python/tests/test_collections.py | 2 ++
2 files changed, 7 insertions(+), 8 deletions(-)
via 8b2eb7d1fa47e4a691849a485573c5da79bb1e2e (commit)
from 735143cbf278a87d975f71152471d59795836460 (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 8b2eb7d1fa47e4a691849a485573c5da79bb1e2e
Author: Lucas Di Pentima <ldipentima at veritasgenetics.com>
Date: Wed Jan 16 18:33:49 2019 -0300
14539: Fixes literal backslash escaping.
Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <ldipentima at veritasgenetics.com>
diff --git a/sdk/python/arvados/_normalize_stream.py b/sdk/python/arvados/_normalize_stream.py
index f1f6052cd..a119da238 100644
--- a/sdk/python/arvados/_normalize_stream.py
+++ b/sdk/python/arvados/_normalize_stream.py
@@ -8,14 +8,11 @@ from . import config
import re
def escape(path):
- replacements = [
- ('\t', '\\011'),
- ('\n', '\\012'),
- (' ', '\\040'),
- ]
- path = re.sub('\\\\([0-3][0-7][0-7])', lambda m: '\\134'+m.group(1), path)
- for a, b in replacements:
- path = path.replace(a, b)
+ # Escape literal backslash
+ path = re.sub('\\\\', lambda m: '\\134', path)
+ # Escape other special chars. Py3's oct() output differs from Py2, this takes
+ # care of those differences.
+ path = re.sub('([\t\n\r: ])', lambda m: '\\'+oct(ord(m.group(1))).replace('o', '')[-3:], path)
return path
def normalize_stream(stream_name, stream):
diff --git a/sdk/python/tests/test_collections.py b/sdk/python/tests/test_collections.py
index f3ad16ecf..91d1797d0 100644
--- a/sdk/python/tests/test_collections.py
+++ b/sdk/python/tests/test_collections.py
@@ -962,6 +962,8 @@ class NewCollectionTestCase(unittest.TestCase, CollectionTestMixin):
cases = [
('\\011', '\t'),
('\\012', '\n'),
+ ('\\072', ':'),
+ ('\\134400', '\\400'),
]
for encoded, decoded in cases:
manifest = '. d41d8cd98f00b204e9800998ecf8427e+0 0:0:some%sfile.txt\n' % encoded
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list