39b600e9e564db3dec265fcf2e3db4b5568dd93a

Author
Marc Cornellà <hello@mcornella.com>
Committer
Marc Cornellà <hello@mcornella.com>
Date

Message

fix(lib): encode all arguments besides the first in `omz_urlencode`

Fixes https://github.com/ohmyzsh/ohmyzsh/commit/140c977a3d82410f48c198596de193d2d6b7b9b5#commitcomment-73688165

Diff

 1diff --git a/lib/functions.zsh b/lib/functions.zsh
 2index 61f4dd49e0e877b71a1e2ad2069e6fbab26f2df3..dfcc4d961084805965d81a49d1efa218f756c5b5 100644
 3--- a/lib/functions.zsh
 4+++ b/lib/functions.zsh
 5@@ -144,7 +144,7 @@ zmodload zsh/langinfo
 6 # Returns nonzero if encoding failed.
 7 #
 8 # Usage:
 9-#  omz_urlencode [-r] [-m] [-P] <string>
10+#  omz_urlencode [-r] [-m] [-P] <string> [<string> ...]
11 #
12 #    -r causes reserved characters (;/?:@&=+$,) to be escaped
13 #
14@@ -156,7 +156,7 @@ function omz_urlencode() {
15   local -a opts
16   zparseopts -D -E -a opts r m P
17 
18-  local in_str=$1
19+  local in_str="$@"
20   local url_str=""
21   local spaces_as_plus
22   if [[ -z $opts[(r)-P] ]]; then spaces_as_plus=1; fi