mirror of
https://github.com/robbyrussell/oh-my-zsh.git
synced 2026-11-26 18:33:03 +01:00
fix(web-search): escape reserved characters like + and & (#14275)
This commit is contained in:
1 parent
1a05a1091b
commit
4d643a3c86
1 file changed
+3
-2
@@ -53,10 +53,11 @@ function web_search() {
|
||||
|
||||
# search or go to main page depending on number of arguments passed
|
||||
if [[ $# -gt 1 ]]; then
|
||||
# if search goes in the query string ==> space as +, otherwise %20
|
||||
# if search goes in the query string ==> space as + and escape reserved
|
||||
# characters like & and +, otherwise %20
|
||||
# see https://stackoverflow.com/questions/1634271/url-encoding-the-space-character-or-20
|
||||
local param="-P"
|
||||
[[ "$urls[$1]" == *\?*= ]] && param=""
|
||||
[[ "$urls[$1]" == *\?*= ]] && param="-r"
|
||||
|
||||
# build search url:
|
||||
# join arguments passed with '+', then append to search engine URL
|
||||
|
||||
Reference in new issue
Block a user