@@ -49,6 +49,7 @@ def log_for_run(self, run_id, message):
49
49
def collect_attachments (self , run_id = None ):
50
50
tempdir = tempfile .mkdtemp ()
51
51
body = {}
52
+ has_attachments = False
52
53
for k , ls in iterlists (connexion .request .files ):
53
54
for v in ls :
54
55
if k == "workflow_attachment" :
@@ -62,7 +63,7 @@ def collect_attachments(self, run_id=None):
62
63
os .makedirs (os .path .dirname (dest ))
63
64
self .log_for_run (run_id , "Staging attachment '%s' to '%s'" % (v .filename , dest ))
64
65
v .save (dest )
65
- body [ k ] = "file://%s" % tempdir # Reference to temp working dir.
66
+ has_attachments = True
66
67
elif k in ("workflow_params" , "tags" , "workflow_engine_parameters" ):
67
68
content = v .read ()
68
69
body [k ] = json .loads (content .decode ("utf-8" ))
@@ -77,9 +78,11 @@ def collect_attachments(self, run_id=None):
77
78
78
79
if "workflow_url" in body :
79
80
if ":" not in body ["workflow_url" ]:
81
+ if not has_attachments :
82
+ raise ValueError ("Relative 'workflow_url' but missing 'workflow_attachment'" )
80
83
body ["workflow_url" ] = "file://%s" % os .path .join (tempdir , secure_filename (body ["workflow_url" ]))
81
84
self .log_for_run (run_id , "Using workflow_url '%s'" % body .get ("workflow_url" ))
82
85
else :
83
- raise Exception ("Missing 'workflow_url' in submission" )
86
+ raise ValueError ("Missing 'workflow_url' in submission" )
84
87
85
88
return tempdir , body
0 commit comments