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

This commit is contained in:
James Langley 2025-06-08 09:25:23 +01:00 committed by GitHub
parent ac5295678f
commit 788eaa5930
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -23,6 +23,9 @@ function open_command() {
linux*) [[ "$(uname -r)" != *icrosoft* ]] && open_cmd='nohup xdg-open' || { linux*) [[ "$(uname -r)" != *icrosoft* ]] && open_cmd='nohup xdg-open' || {
open_cmd='cmd.exe /c start ""' open_cmd='cmd.exe /c start ""'
[[ -e "$1" ]] && { 1="$(wslpath -w "${1:a}")" || return 1 } [[ -e "$1" ]] && { 1="$(wslpath -w "${1:a}")" || return 1 }
[[ "$1" = (http|https)://* ]] && {
1="$(echo "$1" | sed -E 's/([&|()<>^])/^\1/g')" || return 1
}
} ;; } ;;
msys*) open_cmd='start ""' ;; msys*) open_cmd='start ""' ;;
*) echo "Platform $OSTYPE not supported" *) echo "Platform $OSTYPE not supported"