diff --git a/gitlab/functions.sh b/gitlab/functions.sh index c173d421a4dbdc00a23cf188e61b67f6a9b1cecd..7a82b73d5baa339d7450bf8c3fbfeb5e2d589f3e 100644 --- a/gitlab/functions.sh +++ b/gitlab/functions.sh @@ -264,26 +264,22 @@ dav_upload_folder() { fi find "$1" | while read -r fname; do - # make sure the location has at least 1 '/' at the end - # more than 1 '/' together (e.g. '//') is interpreted as 1 '/' - local safe_remote_prefix="$2/" - # replace the local path prefix ('../folder1/folder2/folder-to-upload/') # with the server path prefix ('private-upload/docs/test/') # to make something like '../folder1/folder2/folder-to-upload/test.txt' # into 'private-upload/docs/test.txt' - local server_path="${fname/$1/$safe_remote_prefix}" + local server_path="${fname}/${1}/${2}" # if its a file... - if [[ -f "$fname" ]]; then + if [[ -f "${fname}" ]]; then # upload the file ... - dav_upload "$fname" "$server_path" + dav_upload "${fname}" "${server_path}" else # if its a dir, create the dir - dav_mkdir "$server_path" + dav_mkdir "${server_path}" fi - log_info "Successfully copied folder $1 with curl" + log_info "Successfully copied folder ${1} with curl" done }