Merge branch '17521-dot-slash-glob' refs #17521
authorPeter Amstutz <peter.amstutz@curii.com>
Fri, 23 Apr 2021 21:02:41 +0000 (17:02 -0400)
committerPeter Amstutz <peter.amstutz@curii.com>
Fri, 23 Apr 2021 21:02:41 +0000 (17:02 -0400)
Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <peter.amstutz@curii.com>

sdk/cwl/arvados_cwl/fsaccess.py
sdk/cwl/tests/10380-trailing-slash-dir.cwl [new file with mode: 0644]
sdk/cwl/tests/17521-dot-slash-glob.cwl [new file with mode: 0644]
sdk/cwl/tests/arvados-tests.yml

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)
 
diff --git a/sdk/cwl/tests/10380-trailing-slash-dir.cwl b/sdk/cwl/tests/10380-trailing-slash-dir.cwl
new file mode 100644 (file)
index 0000000..5eec729
--- /dev/null
@@ -0,0 +1,15 @@
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: Apache-2.0
+
+cwlVersion: v1.2
+class: CommandLineTool
+inputs: []
+outputs:
+  stuff:
+    type: Directory
+    outputBinding:
+      glob: './foo/'
+requirements:
+  ShellCommandRequirement: {}
+arguments: [{shellQuote: false, valueFrom: "mkdir -p foo && touch baz.txt && touch foo/bar.txt"}]
diff --git a/sdk/cwl/tests/17521-dot-slash-glob.cwl b/sdk/cwl/tests/17521-dot-slash-glob.cwl
new file mode 100644 (file)
index 0000000..1e182c1
--- /dev/null
@@ -0,0 +1,15 @@
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: Apache-2.0
+
+cwlVersion: v1.2
+class: CommandLineTool
+inputs: []
+outputs:
+  stuff:
+    type: File
+    outputBinding:
+      glob: './foo/*.txt'
+requirements:
+  ShellCommandRequirement: {}
+arguments: [{shellQuote: false, valueFrom: "mkdir -p foo && touch baz.txt && touch foo/bar.txt"}]
index 48255f85756a67ed7fa6026940695c8652bdb41c..199ced9f41fc936a92eb6a8fe07809675971c2c4 100644 (file)
   output: {}
   tool: wf/trick_defaults2.cwl
   doc: "Test issue 17462 - secondary file objects on file defaults are not resolved"
+
+- job: null
+  output: {}
+  tool: 17521-dot-slash-glob.cwl
+  doc: "Test issue 17521 - bug with leading './' capturing files in subdirectories"
+
+- job: null
+  output: {}
+  tool: 10380-trailing-slash-dir.cwl
+  doc: "Test issue 10380 - bug with trailing slash when capturing an output directory"