diff --git a/bash/drive-utils.bash b/bash/drive-utils.bash index d508d6f..a98c8ed 100755 --- a/bash/drive-utils.bash +++ b/bash/drive-utils.bash @@ -169,8 +169,9 @@ _upload_file_from_uri() { -o- \ --url "${uploadlink}" \ --globoff \ - ${CURL_SPEED} ${resume_args} || :)" - [[ -z ${VERBOSE_PROGRESS} ]] && for _ in 1 2; do _clear_line 1; done + ${CURL_SPEED} ${resume_args1} ${resume_args2} \ + -H "${resume_args3}" || :)" + [[ -z ${VERBOSE_PROGRESS} ]] && for _ in 1 2; do _clear_line 1; done && "${1:-:}" return 0 } # logging in case of successful upload @@ -295,8 +296,8 @@ _upload_file() { content_range="$(printf "bytes %s-%s/%s\n" "$((uploaded_range + 1))" "$((inputsize - 1))" "${inputsize}")" content_length="$((inputsize - $((uploaded_range + 1))))" # Resuming interrupted uploads needs http1.1 - resume_args='-s --http1.1 -H "Content-Range: '${content_range}'"' - _upload_file_from_uri + resume_args1='-s' resume_args2='--http1.1' resume_args3="Content-Range: ${content_range}" + _upload_file_from_uri _clear_line _collect_file_info "${upload_body}" "${slug}" || return 1 _normal_logging_upload _remove_upload_session diff --git a/bash/upload.bash b/bash/upload.bash index 098240e..7eab42c 100755 --- a/bash/upload.bash +++ b/bash/upload.bash @@ -519,7 +519,7 @@ _process_arguments() { _print_center "justify" "Given Input" ": FOLDER" "-" _print_center "justify" "Upload Method" ": ${SKIP_DUPLICATES:-${OVERWRITE:-Create}}" "=" && _newline "\n" - FOLDER_NAME="${input##*/}" && _print_center "justify" "Folder: ${FOLDER_NAME}" "=" + FOLDER_NAME="${input##*/}" && "${EXTRA_LOG}" "justify" "Folder: ${FOLDER_NAME}" "=" NEXTROOTDIRID="${WORKSPACE_FOLDER_ID}" @@ -541,7 +541,7 @@ _process_arguments() { # Skip the sub folders and find recursively all the files and upload them. if [[ -n ${SKIP_SUBDIRS} ]]; then if [[ -n ${FILENAMES[0]} ]]; then - _clear_line 1 + for _ in 1 2; do _clear_line 1; done NO_OF_FILES="${#FILENAMES[@]}" "${QUIET:-_print_center}" "justify" "Folder: ${FOLDER_NAME} " "| ${NO_OF_FILES} File(s)" "=" && printf "\n" @@ -558,7 +558,7 @@ _process_arguments() { fi else if [[ -n ${FILENAMES[0]} ]]; then - _clear_line 1 + for _ in 1 2; do _clear_line 1; done NO_OF_FILES="${#FILENAMES[@]}" "${QUIET:-_print_center}" "justify" "${FOLDER_NAME} " "| ${NO_OF_FILES} File(s) | ${NO_OF_SUB_FOLDERS} Sub-folders" "=" diff --git a/sh/drive-utils.sh b/sh/drive-utils.sh index 22630b0..d24cec6 100755 --- a/sh/drive-utils.sh +++ b/sh/drive-utils.sh @@ -169,8 +169,9 @@ _upload_file_from_uri() { -o- \ --url "${uploadlink_upload_file}" \ --globoff \ - ${CURL_SPEED} ${resume_args_upload_file} || :)" - [ -z "${VERBOSE_PROGRESS}" ] && for _ in 1 2; do _clear_line 1; done + ${CURL_SPEED} ${resume_args1} ${resume_args2} \ + -H "${resume_args3}" || :)" + [ -z "${VERBOSE_PROGRESS}" ] && for _ in 1 2; do _clear_line 1; done && "${1:-:}" return 0 } @@ -285,7 +286,7 @@ _upload_file() { # https://developers.google.com/drive/api/v3/manage-uploads if [ -r "${__file_upload_file}" ]; then uploadlink_upload_file="$(cat "${__file_upload_file}" || :)" - http_code_upload_file="$(curl --compressed -s -X PUT "${uploadlink_upload_file}" --write-out %"{http_code_upload_file}")" || : + http_code_upload_file="$(curl --compressed -s -X PUT "${uploadlink_upload_file}" --write-out %"{http_code}")" || : case "${http_code_upload_file}" in 308) # Active Resumable URI give 308 status uploaded_range_upload_file="$(raw_upload_file="$(curl --compressed -s -X PUT \ @@ -297,8 +298,8 @@ _upload_file() { content_range_upload_file="$(printf "bytes %s-%s/%s\n" "$((uploaded_range_upload_file + 1))" "$((inputsize_upload_file - 1))" "${inputsize_upload_file}")" content_length_upload_file="$((inputsize_upload_file - $((uploaded_range_upload_file + 1))))" # Resuming interrupted uploads needs http1.1 - resume_args_upload_file='-s --http1.1 -H "Content-Range: '${content_range_upload_file}'"' - _upload_file_from_uri + resume_args1='-s' resume_args2='--http1.1' resume_args3="Content-Range: ${content_range_upload_file}" + _upload_file_from_uri _clear_line _collect_file_info "${upload_body_upload_file}" "${slug_upload_file}" || return 1 _normal_logging_upload _remove_upload_session diff --git a/sh/upload.sh b/sh/upload.sh index 7e0de7a..63369c2 100755 --- a/sh/upload.sh +++ b/sh/upload.sh @@ -535,7 +535,7 @@ _process_arguments() { _print_center "justify" "Given Input" ": FOLDER" "-" _print_center "justify" "Upload Method" ": ${SKIP_DUPLICATES:-${OVERWRITE:-Create}}" "=" && _newline "\n" - FOLDER_NAME="${input##*/}" && _print_center "justify" "Folder: ${FOLDER_NAME}" "=" + FOLDER_NAME="${input##*/}" && "${EXTRA_LOG}" "justify" "Folder: ${FOLDER_NAME}" "=" NEXTROOTDIRID="${WORKSPACE_FOLDER_ID}" @@ -558,7 +558,7 @@ _process_arguments() { if [ -n "${SKIP_SUBDIRS}" ]; then if [ -n "${FILENAMES}" ]; then NO_OF_FILES="$(($(printf "%s\n" "${FILENAMES}" | wc -l)))" - _clear_line 1 + for _ in 1 2; do _clear_line 1; done "${QUIET:-_print_center}" "justify" "Folder: ${FOLDER_NAME} " "| ${NO_OF_FILES} File(s)" "=" && printf "\n" "${EXTRA_LOG}" "justify" "Creating folder.." "-" @@ -575,7 +575,7 @@ _process_arguments() { else if [ -n "${FILENAMES}" ]; then NO_OF_FILES="$(($(printf "%s\n" "${FILENAMES}" | wc -l)))" - _clear_line 1 + for _ in 1 2; do _clear_line 1; done "${QUIET:-_print_center}" "justify" "${FOLDER_NAME} " "| $((NO_OF_FILES)) File(s) | $((NO_OF_SUB_FOLDERS)) Sub-folders" "=" _newline "\n" && "${EXTRA_LOG}" "justify" "Creating Folder(s).." "-" && _newline "\n"