mirror of
https://github.com/paulirish/git-open.git
synced 2026-09-10 07:26:15 -04:00
fix: use eval for browser command to handle quoted arguments
Browser commands like `open -a 'Microsoft Edge'` need eval so quotes inside the variable are interpreted as shell syntax, not literal characters. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
7adaeb3128
commit
01813c1d9d
2
git-open
2
git-open
|
|
@ -301,4 +301,4 @@ if (( print_only )); then
|
|||
fi
|
||||
|
||||
# open it in a browser
|
||||
${BROWSER:-${browser:-$open}} "$openurl"
|
||||
eval "${BROWSER:-${browser:-$open}}" \"\$openurl\"
|
||||
|
|
|
|||
|
|
@ -701,6 +701,15 @@ setup() {
|
|||
assert_output "DEFAULT https://github.com/personal/repo"
|
||||
}
|
||||
|
||||
@test "browser: handles quoted arguments in browser command" {
|
||||
git remote set-url origin "git@github.com:user/repo.git"
|
||||
git checkout -B "master"
|
||||
git config --local open.browser "echo 'spaced arg'"
|
||||
unset BROWSER
|
||||
run ../git-open
|
||||
assert_output "spaced arg https://github.com/user/repo"
|
||||
}
|
||||
|
||||
@test "browser: BROWSER env var takes priority over config" {
|
||||
git remote set-url origin "git@github.com:user/repo.git"
|
||||
git checkout -B "master"
|
||||
|
|
|
|||
Loading…
Reference in a new issue