Skip to content

Commit

Permalink
gsync: Fix gsync not working with gdrive folder name with space | Fix l…
Browse files Browse the repository at this point in the history
…abbots#126

use eval to to escape the extra qouting
  • Loading branch information
Akianonymus committed Nov 5, 2020
1 parent 8a32561 commit 7cc81a5
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions bash/release/gsync
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ _check_and_upload() {
declare -A Aseen && for new_file in "${new_files[@]}"; do
{ [[ ${Aseen[new_file]} ]] && continue; } || Aseen[${new_file}]=x
# shellcheck disable=SC2086
if "${COMMAND_NAME}" "${new_file}" ${ARGS}; then
if eval \"${COMMAND_NAME}\" \"${new_file}\" ${ARGS}; then
printf "%s\n" "${new_file}" >> "${SUCCESS_LOG}"
else
printf "%s\n" "${new_file}" >> "${ERROR_LOG}"
Expand Down Expand Up @@ -748,7 +748,7 @@ _setup_arguments() {
-d | --directory)
_check_longoptions "${1}" "${2}"
GDRIVE_FOLDER="${2}" && shift
ARGS+=" -C ${GDRIVE_FOLDER} "
ARGS+=" -C \"${GDRIVE_FOLDER}\" "
;;
-j | --jobs)
[[ ${2} = v* ]] && SHOW_JOBS_VERBOSE="true" && shift
Expand Down
4 changes: 2 additions & 2 deletions bash/sync.bash
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ _check_and_upload() {
declare -A Aseen && for new_file in "${new_files[@]}"; do
{ [[ ${Aseen[new_file]} ]] && continue; } || Aseen[${new_file}]=x
# shellcheck disable=SC2086
if "${COMMAND_NAME}" "${new_file}" ${ARGS}; then
if eval \"${COMMAND_NAME}\" \"${new_file}\" ${ARGS}; then
printf "%s\n" "${new_file}" >> "${SUCCESS_LOG}"
else
printf "%s\n" "${new_file}" >> "${ERROR_LOG}"
Expand Down Expand Up @@ -395,7 +395,7 @@ _setup_arguments() {
-d | --directory)
_check_longoptions "${1}" "${2}"
GDRIVE_FOLDER="${2}" && shift
ARGS+=" -C ${GDRIVE_FOLDER} "
ARGS+=" -C \"${GDRIVE_FOLDER}\" "
;;
-j | --jobs)
[[ ${2} = v* ]] && SHOW_JOBS_VERBOSE="true" && shift
Expand Down
4 changes: 2 additions & 2 deletions sh/release/gsync
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,7 @@ EOF
*) aseen_check_and_upload="${aseen_check_and_upload}|:_//_:|${new_file_check_and_upload}|:_//_:|" ;;
esac; do
# shellcheck disable=SC2086
if "${COMMAND_NAME}" "${new_file_check_and_upload}" ${ARGS}; then
if eval \"${COMMAND_NAME}\" \"${new_file_check_and_upload}\" ${ARGS}; then
printf "%s\n" "${new_file_check_and_upload}" >> "${SUCCESS_LOG}"
else
printf "%s\n" "${new_file_check_and_upload}" >> "${ERROR_LOG}"
Expand Down Expand Up @@ -756,7 +756,7 @@ _setup_arguments() {
-d | --directory)
_check_longoptions "${1}" "${2}"
GDRIVE_FOLDER="${2}" && shift
ARGS=" ${ARGS} -C ${GDRIVE_FOLDER} "
ARGS=" ${ARGS} -C \"${GDRIVE_FOLDER}\" "
;;
-j | --jobs)
case "${2}" in
Expand Down
4 changes: 2 additions & 2 deletions sh/sync.sh
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ EOF
*) aseen_check_and_upload="${aseen_check_and_upload}|:_//_:|${new_file_check_and_upload}|:_//_:|" ;;
esac; do
# shellcheck disable=SC2086
if "${COMMAND_NAME}" "${new_file_check_and_upload}" ${ARGS}; then
if eval \"${COMMAND_NAME}\" \"${new_file_check_and_upload}\" ${ARGS}; then
printf "%s\n" "${new_file_check_and_upload}" >> "${SUCCESS_LOG}"
else
printf "%s\n" "${new_file_check_and_upload}" >> "${ERROR_LOG}"
Expand Down Expand Up @@ -425,7 +425,7 @@ _setup_arguments() {
-d | --directory)
_check_longoptions "${1}" "${2}"
GDRIVE_FOLDER="${2}" && shift
ARGS=" ${ARGS} -C ${GDRIVE_FOLDER} "
ARGS=" ${ARGS} -C \"${GDRIVE_FOLDER}\" "
;;
-j | --jobs)
case "${2}" in
Expand Down

0 comments on commit 7cc81a5

Please sign in to comment.