788eaa5930eeafceb0cc43f338b0bacf7a2e36a8

Author
James Langley <jwblangley@gmail.com>
Committer
GitHub <noreply@github.com>
Date

Message

fix(functions): escape especial chars in WSL (#13158)

Diff

 1diff --git a/lib/functions.zsh b/lib/functions.zsh
 2index b68c35c13dc801419f3a9dbb8773497d7ba2adbd..330b0e3e92e2d1728b6d23fb452abceda5d00239 100644
 3--- a/lib/functions.zsh
 4+++ b/lib/functions.zsh
 5@@ -23,6 +23,9 @@ function open_command() {
 6     linux*)   [[ "$(uname -r)" != *icrosoft* ]] && open_cmd='nohup xdg-open' || {
 7                 open_cmd='cmd.exe /c start ""'
 8                 [[ -e "$1" ]] && { 1="$(wslpath -w "${1:a}")" || return 1 }
 9+                [[ "$1" = (http|https)://* ]] && {
10+                  1="$(echo "$1" | sed -E 's/([&|()<>^])/^\1/g')" || return 1
11+                }
12               } ;;
13     msys*)    open_cmd='start ""' ;;
14     *)        echo "Platform $OSTYPE not supported"