17521: Use normpath to clean up the path segment.
authorPeter Amstutz <peter.amstutz@curii.com>
Fri, 23 Apr 2021 20:07:02 +0000 (16:07 -0400)
committerPeter Amstutz <peter.amstutz@curii.com>
Fri, 23 Apr 2021 20:15:17 +0000 (16:15 -0400)
Removes leading ./, trailing slashes, redundant '.' and blank path
segments, and other stuff that potentially confuses the path matching.

Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <peter.amstutz@curii.com>

sdk/cwl/arvados_cwl/fsaccess.py

index 16ec2b2f968e868104a4e0b18dad0a23654d4619..1e339d5bb7d4ab20f90438ed5670f3d67d51e548 100644 (file)
@@ -100,7 +100,8 @@ class CollectionFsAccess(cwltool.stdfsaccess.StdFsAccess):
         if p.startswith("keep:") and (arvados.util.keep_locator_pattern.match(p[5:]) or
                                       arvados.util.collection_uuid_pattern.match(p[5:])):
             locator = p[5:]
-            return (self.collection_cache.get(locator), urllib.parse.unquote(sp[1]) if len(sp) == 2 else None)
+            rest = os.path.normpath(urllib.parse.unquote(sp[1])) if len(sp) == 2 else None
+            return (self.collection_cache.get(locator), rest)
         else:
             return (None, path)