浏览代码

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.
LE Manh Cuong 9 年之前
父节点
当前提交
758195cb79
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2 2
      plugins/encode64/encode64.plugin.zsh

+ 2 - 2
plugins/encode64/encode64.plugin.zsh

@@ -1,4 +1,4 @@
-encode64(){ echo -n $1 | base64 }
-decode64(){ echo -n $1 | base64 --decode }
+encode64(){ printf '%s' $1 | base64 }
+decode64(){ printf '%s' $1 | base64 --decode }
 alias e64=encode64
 alias d64=decode64