diff --git a/crc/scripts/email.py b/crc/scripts/email.py index d3a64725..6f8244dd 100644 --- a/crc/scripts/email.py +++ b/crc/scripts/email.py @@ -73,19 +73,7 @@ Email Subject ApprvlApprvr1 PIComputingID message="Email script requires at least one subject argument. The " "name of the variable in the task data that contains subject" " to process. Multiple arguments are accepted.") - - subject_index = 0 - subject = args[subject_index] - if subject.startswith('"') and not subject.endswith('"'): - # Multi-word subject - subject_index += 1 - next_word = args[subject_index] - while not next_word.endswith('"'): - subject = ' '.join((subject, next_word)) - subject_index += 1 - next_word = args[subject_index] - subject = ' '.join((subject, next_word)) - subject = subject.replace('"', '') + subject = args[0] if not isinstance(subject, str): raise ApiError(code="invalid_argument", message="The Email script requires 1 argument. The " diff --git a/crc/services/workflow_processor.py b/crc/services/workflow_processor.py index dde14bb5..52aa5a33 100644 --- a/crc/services/workflow_processor.py +++ b/crc/services/workflow_processor.py @@ -1,4 +1,5 @@ import re +import shlex import xml.etree.ElementTree as ElementTree from datetime import datetime from typing import List @@ -36,7 +37,9 @@ class CustomBpmnScriptEngine(BpmnScriptEngine): This allows us to reference custom code from the BPMN diagram. """ - commands = script.split(" ") + # Shlex splits the whole string while respecting double quoted strings within + commands = shlex.split(script) + printable_comms = commands path_and_command = commands[0].rsplit(".", 1) if len(path_and_command) == 1: module_name = "crc.scripts." + self.camel_to_snake(path_and_command[0])