Escape cmd.exe special chars for URLs in open_command

This commit is contained in:
James Langley 2025-06-07 19:25:48 +01:00
commit fb60b9b6dc

View file

@ -23,6 +23,7 @@ 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"