From 4da67218c166374016c239397db2c10f3a388e66 Mon Sep 17 00:00:00 2001 From: takadonet Date: Thu, 12 Jul 2018 12:08:15 -0500 Subject: [PATCH] Added fix to ensure that original ftp files that have been uploaded are purged if set in galaxy.yml with flag ftp_upload_purge. Address issue #6492 --- tools/data_source/upload.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tools/data_source/upload.py b/tools/data_source/upload.py index 3e05aef66e9..30bfded05aa 100644 --- a/tools/data_source/upload.py +++ b/tools/data_source/upload.py @@ -141,7 +141,12 @@ def add_file(dataset, registry, output_path): # Move the dataset to its "real" path. converted_path is a tempfile so we move it even if purge_source is False. if purge_source or converted_path: try: - shutil.move(converted_path or dataset.path, output_path) + # If user has indicated that the original file to be purged and have converted_path tempfile + if purge_source and converted_path: + shutil.move(converted_path, output_path) + os.remove(dataset.path) + else: + shutil.move(converted_path or dataset.path, output_path) except OSError as e: # We may not have permission to remove the input if e.errno != errno.EACCES: