From abf89c6a958f7d4174b66ac89c71819d2ff57671 Mon Sep 17 00:00:00 2001 From: Sergio Semedi Barranco Date: Mon, 8 Oct 2018 11:36:20 +0200 Subject: [PATCH] B #2437: vCenter uploads files with proper names (#2469) --- src/datastore_mad/remotes/vcenter/cp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/datastore_mad/remotes/vcenter/cp b/src/datastore_mad/remotes/vcenter/cp index 94c14ec7cc..93faef60bf 100755 --- a/src/datastore_mad/remotes/vcenter/cp +++ b/src/datastore_mad/remotes/vcenter/cp @@ -71,6 +71,7 @@ end temp_file = nil filename = File.basename(img_path) target_path = "#{ds_image_dir}/#{id}" +ext = File.extname(filename) # If image is in a remote http location it has to be downloaded # or if is a zipped file it has to be unzipped in a temp folder @@ -151,8 +152,12 @@ files_to_upload.each_with_index do |f, index| end if is_last_file_to_upload?(index, files_to_upload) - uploader_args = ds_id + " " + ds_ref + " " + - "#{path}#{extension}" + " " + f + if ext == "" + uploader_args = ds_id + " " + ds_ref + " " + + "#{path}#{extension}" + " " + f + else + uploader_args = ds_id + " " + ds_ref + " " + path + " " + f + end else uploader_args = ds_id + " " + ds_ref + " " + path + " " + f + " &> /dev/null"