mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-08-07 06:08:39 +02:00
fix(aws): quote dirname command substitution in state file path check
_aws_update_state() and _aws_clear_state() check the state file's
directory with test -d $(dirname ${AWS_STATE_FILE}), unquoted. In zsh,
command substitution output is word-split even though plain $var
expansion isn't. If AWS_STATE_FILE's directory contains a space, the
split output makes test -d receive multiple arguments and fail
silently, so the profile/region never gets persisted.
Quoting the inner variable and the outer command substitution fixes
the word-split.
This commit is contained in:
parent
677a4592b1
commit
8929d31533
1 changed files with 2 additions and 2 deletions
|
|
@ -9,14 +9,14 @@ function agr() {
|
||||||
# Update state file if enabled
|
# Update state file if enabled
|
||||||
function _aws_update_state() {
|
function _aws_update_state() {
|
||||||
if [[ "$AWS_PROFILE_STATE_ENABLED" == true ]]; then
|
if [[ "$AWS_PROFILE_STATE_ENABLED" == true ]]; then
|
||||||
test -d $(dirname ${AWS_STATE_FILE}) || return 1
|
test -d "$(dirname "${AWS_STATE_FILE}")" || return 1
|
||||||
echo "${AWS_PROFILE} ${AWS_REGION}" > "${AWS_STATE_FILE}"
|
echo "${AWS_PROFILE} ${AWS_REGION}" > "${AWS_STATE_FILE}"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function _aws_clear_state() {
|
function _aws_clear_state() {
|
||||||
if [[ "$AWS_PROFILE_STATE_ENABLED" == true ]]; then
|
if [[ "$AWS_PROFILE_STATE_ENABLED" == true ]]; then
|
||||||
test -d $(dirname ${AWS_STATE_FILE}) || return 1
|
test -d "$(dirname "${AWS_STATE_FILE}")" || return 1
|
||||||
echo -n > "${AWS_STATE_FILE}"
|
echo -n > "${AWS_STATE_FILE}"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue