Skip to content

Commit 427eb65

Browse files
illusionalmr-c
authored andcommitted
Add secondaryFile name instance check per review
1 parent 438ebe4 commit 427eb65

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

cwltool/builder.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -392,10 +392,20 @@ def _capture_files(f): # type: (Dict[str, str]) -> Dict[str, str]
392392
found = False
393393

394394
if isinstance(sfname, str):
395-
sf_location = datum["location"][0:datum["location"].rindex("/")+1]+sfname
396-
else:
395+
sf_location = (
396+
datum["location"][
397+
0 : datum["location"].rindex("/") + 1
398+
]
399+
+ sfname
400+
)
401+
elif isinstance(sfname, MutableMapping):
397402
sf_location = sfname["location"]
398403
sfname = sfname["basename"]
404+
else:
405+
raise WorkflowException(
406+
"Expected secondaryFile expression to return type 'str' or 'MutableMapping', received '%s'"
407+
% (type(sfname))
408+
)
399409

400410
for d in datum["secondaryFiles"]:
401411
if not d.get("basename"):

0 commit comments

Comments
 (0)