Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion scripts/commands/helm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,12 @@ helm_wrapper() {
fatal 'Unable to decrypt literal value %s' "${literal}"
fi

if [ "${decrypted_literal}" = "${literal}" ]; then

# Command substitution $( ) strips trailing newlines, so a literal ending in a newline
# will never equal its decrypted value (both the same plain-text string, but lengths differ).
# Comparing length via printf+wc-c distinguishes unchanged values from values that only
# lost a trailing newline due to shell expansion.
if [ "${decrypted_literal}" = "${literal}" ] && [ "$(printf "%s" "${decrypted_literal}" | wc -c)" -eq "$(printf "%s" "${literal}" | wc -c)" ]; then
decrypted_literals="${decrypted_literals}${opt_prefix}${decrypted_literal},"
else
decrypted_literals="${decrypted_literals}${opt_prefix}$(printf '%s' "${decrypted_literal}" | sed -e 's/\\/\\\\/g' | sed -e 's/,/\\,/g'),"
Expand Down
Loading