758195cb791556c3f5268e7e075f3ab55bcd5e90

Author
LE Manh Cuong <manhcuongle@hotmail.com>
Committer
LE Manh Cuong <manhcuongle@hotmail.com>
Date

Message

Encode64 Plugin - Fix wrong `echo` usage

Currently, encode64 plugin using `echo -n` to print the content
of $1 variable. This approach will not work with arbitrary data,
which contains sequence of escaped characters, since when many
`echo` implementation will expand them.

This commit chage the usage to `printf`, which is builtin in all
POSIX shells and can print arbitrary data reliability.

Diff

 1diff --git a/plugins/encode64/encode64.plugin.zsh b/plugins/encode64/encode64.plugin.zsh
 2index 4dbd1b453978670982c5d6d251048b9565db3178..53de6478a3deac691764c6832b03bc2795f60d47 100644
 3--- a/plugins/encode64/encode64.plugin.zsh
 4+++ b/plugins/encode64/encode64.plugin.zsh
 5@@ -1,4 +1,4 @@
 6-encode64(){ echo -n $1 | base64 }
 7-decode64(){ echo -n $1 | base64 --decode }
 8+encode64(){ printf '%s' $1 | base64 }
 9+decode64(){ printf '%s' $1 | base64 --decode }
10 alias e64=encode64
11 alias d64=decode64