From fb60b9b6dc031733dc27d08c136bebd2c8439080 Mon Sep 17 00:00:00 2001 From: James Langley Date: Sat, 7 Jun 2025 19:25:48 +0100 Subject: [PATCH] Escape cmd.exe special chars for URLs in open_command --- lib/functions.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/functions.zsh b/lib/functions.zsh index b68c35c13..1787cd6ad 100644 --- a/lib/functions.zsh +++ b/lib/functions.zsh @@ -23,6 +23,7 @@ function open_command() { linux*) [[ "$(uname -r)" != *icrosoft* ]] && open_cmd='nohup xdg-open' || { open_cmd='cmd.exe /c start ""' [[ -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 ""' ;; *) echo "Platform $OSTYPE not supported"