Skip to content

Commit

Permalink
Fix copy-dataprocessings crashing
Browse files Browse the repository at this point in the history
A dataProcessingItem can have zero input/output. We must check this
before trying to access a potentially non-existent property.
  • Loading branch information
drscholly committed Dec 13, 2023
1 parent 4f4a04f commit 620ec6f
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions toolbox/commands/copy_dataprocessings.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,14 @@ def copy_dataprocessings(url_source: str,
if "summary" in items[item_index] and items[item_index]['summary'] is None:
items[item_index]['summary'] = ""
# for inputs and outputs, property 'path' must be named 'entityPath'
for input in item['inputs']:
input_index = item['inputs'].index(input)
items[item_index]['inputs'][input_index]['entityPath'] = input['path']
for output in item['outputs']:
output_index = item['outputs'].index(output)
items[item_index]['outputs'][output_index]['entityPath'] = output['path']
if 'inputs' in item:
for input in item['inputs']:
input_index = item['inputs'].index(input)
items[item_index]['inputs'][input_index]['entityPath'] = input['path']
if 'outputs' in item:
for output in item['outputs']:
output_index = item['outputs'].index(output)
items[item_index]['outputs'][output_index]['entityPath'] = output['path']
source_dataprocessings[dp_index]['dataProcessingItems'] = items

# copy the dataprocessings on the target workspace
Expand Down

0 comments on commit 620ec6f

Please sign in to comment.