Skip to content

Commit

Permalink
Fix uploading for files with spaces and other chars
Browse files Browse the repository at this point in the history
my bad, missed in refactoring
  • Loading branch information
Akianonymus committed Jul 24, 2020
1 parent d33fc39 commit 7cdec91
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
8 changes: 6 additions & 2 deletions bash/drive-utils.bash
Original file line number Diff line number Diff line change
Expand Up @@ -339,8 +339,12 @@ _upload_file_main() {

retry="${RETRY:-0}" && unset RETURN_STATUS
until [[ ${retry} -le 0 ]] && [[ -n ${RETURN_STATUS} ]]; do
{ eval _upload_file "${UPLOAD_MODE:-create}" "${file:-${2}}" "${dirid:-${3}}" "${ACCESS_TOKEN}" "${4:+2> /dev/null 1>&2}" && RETURN_STATUS=1 && break; } ||
{ RETURN_STATUS=2 retry="$((retry - 1))" && continue; }
if [[ -n ${4} ]]; then
_upload_file "${UPLOAD_MODE:-create}" "${file:-${2}}" "${dirid:-${3}}" "${ACCESS_TOKEN}" 2> /dev/null 1>&2 && RETURN_STATUS=1 && break
else
_upload_file "${UPLOAD_MODE:-create}" "${file:-${2}}" "${dirid:-${3}}" "${ACCESS_TOKEN}" && RETURN_STATUS=1 && break
fi
RETURN_STATUS=2 retry="$((retry - 1))" && continue
done
printf "%b" "${4:+${RETURN_STATUS}\n}" 1>&"${RETURN_STATUS}"
return 0
Expand Down
8 changes: 6 additions & 2 deletions sh/drive-utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -342,8 +342,12 @@ _upload_file_main() {
retry_upload_file_main="${RETRY:-0}" && unset RETURN_STATUS
until [ "${retry_upload_file_main}" -le 0 ] && [ -n "${RETURN_STATUS}" ]; do
{ eval _upload_file "${UPLOAD_MODE:-create}" "${file_upload_file_main:-${2}}" "${dirid_upload_file_main:-${3}}" "${ACCESS_TOKEN}" "${4:+2> /dev/null 1>&2}" && RETURN_STATUS=1 && break; } ||
{ RETURN_STATUS=2 retry_upload_file_main="$((retry_upload_file_main - 1))" && continue; }
if [ -n "${4}" ]; then
_upload_file "${UPLOAD_MODE:-create}" "${file_upload_file_main:-${2}}" "${dirid_upload_file_main:-${3}}" "${ACCESS_TOKEN}" 2> /dev/null 1>&2 && RETURN_STATUS=1 && break
else
_upload_file "${UPLOAD_MODE:-create}" "${file_upload_file_main:-${2}}" "${dirid_upload_file_main:-${3}}" "${ACCESS_TOKEN}" && RETURN_STATUS=1 && break
fi
RETURN_STATUS=2 retry_upload_file_main="$((retry_upload_file_main - 1))" && continue
done
printf "%b" "${4:+${RETURN_STATUS}\n}" 1>&"${RETURN_STATUS}"
return 0
Expand Down

0 comments on commit 7cdec91

Please sign in to comment.