10401: Add integration tests for directory listing behavior.
[arvados.git] / sdk / cwl / arvados_cwl / fsaccess.py
index a18388f26a9deb9918714b7a373b2532e65d430f..3a3d16073833a6367876b5833b54cbb8f35584e7 100644 (file)
@@ -30,13 +30,14 @@ class CollectionFsAccess(cwltool.stdfsaccess.StdFsAccess):
         self.collections = {}
 
     def get_collection(self, path):
-        p, rest = path.split("/", 1)
+        sp = path.split("/", 1)
+        p = sp[0]
         if p.startswith("keep:") and arvados.util.keep_locator_pattern.match(p[5:]):
             pdh = p[5:]
             if pdh not in self.collections:
                 self.collections[pdh] = arvados.collection.CollectionReader(pdh, api_client=self.api_client,
                                                                             keep_client=self.keep_client)
-            return (self.collections[pdh], rest)
+            return (self.collections[pdh], sp[1] if len(sp) == 2 else None)
         else:
             return (None, path)
 
@@ -79,7 +80,10 @@ class CollectionFsAccess(cwltool.stdfsaccess.StdFsAccess):
     def exists(self, fn):
         collection, rest = self.get_collection(fn)
         if collection:
-            return collection.exists(rest)
+            if rest:
+                return collection.exists(rest)
+            else:
+                return True
         else:
             return super(CollectionFsAccess, self).exists(fn)
 
@@ -151,6 +155,8 @@ class CollectionFetcher(DefaultFetcher):
 
     def check_exists(self, url):
         try:
+            if url.startswith("http://arvados.org/cwl"):
+                return True
             if url.startswith("keep:"):
                 return self.fsaccess.exists(url)
             if url.startswith("arvwf:"):