@@ -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,6 +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 )
66
+ has_attachments = True
65
67
body [k ] = "file://%s" % tempdir # Reference to temp working dir.
66
68
elif k in ("workflow_params" , "tags" , "workflow_engine_parameters" ):
67
69
content = v .read ()
@@ -77,9 +79,11 @@ def collect_attachments(self, run_id=None):
77
79
78
80
if "workflow_url" in body :
79
81
if ":" not in body ["workflow_url" ]:
82
+ if not has_attachments :
83
+ raise ValueError ("Relative 'workflow_url' but missing 'workflow_attachment'" )
80
84
body ["workflow_url" ] = "file://%s" % os .path .join (tempdir , secure_filename (body ["workflow_url" ]))
81
85
self .log_for_run (run_id , "Using workflow_url '%s'" % body .get ("workflow_url" ))
82
86
else :
83
- raise Exception ("Missing 'workflow_url' in submission" )
87
+ raise ValueError ("Missing 'workflow_url' in submission" )
84
88
85
89
return tempdir , body
0 commit comments