diff --git a/src/push.rs b/src/push.rs index 11ce3641a151559faae666d96e3e01868474d162..f09646fbecfcb0996ea50de711cedef12cac71cc 100644 --- a/src/push.rs +++ b/src/push.rs @@ -54,19 +54,6 @@ fn check_glob_exist_local(remote_file: &PathBuf) -> Option<PathBuf> { } } -/// Function that checks if a glob file exists and return the first path found -/// if it's the case -/// -/// # Arguments -/// - `remote_file`: The remote glob located by the remote -/// - `adress`: The adress of the remote folder -fn check_glob_file_exists(remote_file: &PathBuf, adress: &str) -> Option<PathBuf> { - if adress == "file" { - check_glob_exist_local(remote_file) - } else { - check_glob_file_exist_remote(remote_file, adress) - } -} /// Function that check if a dir exist on a remote filesystem /// # Arguments @@ -94,6 +81,22 @@ fn check_glob_file_exist_remote(remote_tar: &PathBuf, adress: &str) -> Option<Pa } } + +/// Function that checks if a glob file exists and return the first path found +/// if it's the case +/// +/// # Arguments +/// - `remote_file`: The remote glob located by the remote +/// - `adress`: The adress of the remote folder +fn check_glob_file_exists(remote_file: &PathBuf, adress: &str) -> Option<PathBuf> { + if adress == "file" { + check_glob_exist_local(remote_file) + } else { + check_glob_file_exist_remote(remote_file, adress) + } +} + + /// Function that check if a dir exist on a remote filesystem /// # Arguments /// - `remote_dir`: The remote dir located by the remote @@ -145,7 +148,7 @@ pub(crate) fn handle_existing_remote_file( adress: &str, cmd: &str, ) -> PathBuf { - let archive = remote_file.file_stem().unwrap().to_str().unwrap(); + let archive = remote_file.file_stem().unwrap().to_str().unwrap().split('.').collect::<Vec<_>>()[0]; let filename_glob = remote_file .parent() .unwrap()