Skip to content

Commit

Permalink
Merge cfa5603 into b539312
Browse files Browse the repository at this point in the history
  • Loading branch information
Dinos Kousidis committed Apr 12, 2018
2 parents b539312 + cfa5603 commit 14c9300
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions reana_workflow_controller/rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,6 @@ def seed_workflow_workspace(workflow_id_or_name):
try:
user_uuid = request.args['user']
file_ = request.files['file_content']
# file_name = secure_filename(request.args['file_name'])
full_file_name = request.args['file_name']
if not full_file_name:
raise ValueError('The file transferred needs to have name.')
Expand All @@ -428,16 +427,20 @@ def seed_workflow_workspace(workflow_id_or_name):
user_uuid)

filename = full_file_name.split("/")[-1]

# Remove starting '/' in path
if full_file_name[0] == '/':
full_file_name = full_file_name[1:]
path = get_analysis_files_dir(workflow, file_type,
'seed')
if len(full_file_name.split("/")) > 1 and not \
os.path.isabs(full_file_name):
if len(full_file_name.split("/")) > 1:
dirs = full_file_name.split("/")[:-1]
path = os.path.join(path, "/".join(dirs))
if not os.path.exists(path):
os.makedirs(path)

file_.save(os.path.join(path, filename))

return jsonify({'message': 'File successfully transferred'}), 200

except WorkflowInexistentError:
Expand Down

0 comments on commit 14c9300

Please sign in to comment.