Skip to content

Commit feeb0be

Browse files
committed
fix loadContents for File[]
1 parent 6d8c2a4 commit feeb0be

File tree

5 files changed

+33
-2
lines changed

5 files changed

+33
-2
lines changed

cwltool/builder.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ def bind_input(
282282
and "itemSeparator" not in binding
283283
):
284284
st["inputBinding"] = {}
285-
for k in ("secondaryFiles", "format", "streamable"):
285+
for k in ("secondaryFiles", "format", "streamable", "loadContents"):
286286
if k in schema:
287287
st[k] = schema[k]
288288
if value_from_expression:
@@ -349,7 +349,7 @@ def bind_input(
349349
"type": schema["items"],
350350
"inputBinding": b2,
351351
}
352-
for k in ("secondaryFiles", "format", "streamable"):
352+
for k in ("secondaryFiles", "format", "streamable", "loadContents"):
353353
if k in schema:
354354
itemschema[k] = schema[k]
355355
bindings.extend(

tests/load_contents-1.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1

tests/load_contents-2.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2

tests/load_contents-array.cwl

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
cwlVersion: "v1.2"
2+
class: CommandLineTool
3+
baseCommand: echo
4+
requirements:
5+
InlineJavascriptRequirement: {}
6+
inputs:
7+
files:
8+
type:
9+
type: array
10+
items: File
11+
loadContents: true
12+
inputBinding:
13+
valueFrom: |
14+
${
15+
return JSON.stringify({
16+
"data": inputs.files.map(item => parseInt(item.contents))
17+
});
18+
}
19+
outputs:
20+
out:
21+
type: File
22+
outputBinding:
23+
glob: "data.json"
24+
stdout: "data.json"

tests/load_contents-array.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
files:
2+
- class: File
3+
path: load_contents-1.txt
4+
- class: File
5+
path: load_contents-2.txt

0 commit comments

Comments
 (0)