[ARVADOS] updated: 2.1.0-2315-g5d039c344

Git user git at public.arvados.org
Fri Apr 15 18:49:31 UTC 2022


Summary of changes:
 sdk/cwl/arvados_cwl/pathmapper.py | 26 ++++++++++++++++----------
 1 file changed, 16 insertions(+), 10 deletions(-)

       via  5d039c344850dfc5fedd03c1050fa51eec404d72 (commit)
      from  faf47b57391a6e704b82623e997d9213ffc9442c (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 5d039c344850dfc5fedd03c1050fa51eec404d72
Author: Peter Amstutz <peter.amstutz at curii.com>
Date:   Fri Apr 15 14:49:12 2022 -0400

    18994: Fix needs_new_collection errors found by tests
    
    Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <peter.amstutz at curii.com>

diff --git a/sdk/cwl/arvados_cwl/pathmapper.py b/sdk/cwl/arvados_cwl/pathmapper.py
index d7b535eeb..64fdfa0d0 100644
--- a/sdk/cwl/arvados_cwl/pathmapper.py
+++ b/sdk/cwl/arvados_cwl/pathmapper.py
@@ -156,17 +156,23 @@ class ArvPathMapper(PathMapper):
         if loc.startswith("_:"):
             return True
 
-        if not prefix:
-            i = loc.rfind("/")
-            if i > -1:
-                prefix = loc[:i+1]
-                suffix = urllib.parse.quote(urllib.parse.unquote(loc[i+1:]), "/+@")
-            else:
-                prefix = loc+"/"
+        i = loc.rfind("/")
+        if i > -1:
+            loc_prefix = loc[:i+1]
+            if not prefix:
+                prefix = loc_prefix
+            # quote/unquote to ensure consistent quoting
+            suffix = urllib.parse.quote(urllib.parse.unquote(loc[i+1:]), "/+@")
         else:
-            suffix = loc[len(prefix):]
+            # no '/' found
+            loc_prefix = loc+"/"
+            prefix = loc+"/"
+            suffix = ""
+
+        if prefix != loc_prefix:
+            return True
 
-        if "basename" in srcobj and prefix+suffix != prefix+urllib.parse.quote(srcobj["basename"], "/+@"):
+        if "basename" in srcobj and suffix != urllib.parse.quote(srcobj["basename"], "/+@"):
             return True
 
         if srcobj["class"] == "File" and loc not in self._pathmap:
@@ -175,7 +181,7 @@ class ArvPathMapper(PathMapper):
             if self.needs_new_collection(s, prefix):
                 return True
         if srcobj.get("listing"):
-            prefix = "%s%s/" % (prefix, srcobj["basename"])
+            prefix = "%s%s/" % (prefix, urllib.parse.quote(srcobj.get("basename", suffix), "/+@"))
             for l in srcobj["listing"]:
                 if self.needs_new_collection(l, prefix):
                     return True

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list