fix: handle browser paths safely (#234)
Some checks failed
CI / basics (push) Has been cancelled

This commit is contained in:
Adrian Miranda 2026-05-24 22:06:15 -03:00 committed by GitHub
parent 41ebfcebe1
commit 63c0e77aaf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -303,8 +303,21 @@ case $( uname -s ) in
esac esac
if (( print_only )); then if (( print_only )); then
BROWSER="echo" printf '%s\n' "$openurl"
exit 0
fi fi
# open it in a browser # open it in a browser
${BROWSER:-$open} "$openurl" if [[ -n "$BROWSER" ]]; then
if [[ -x "$BROWSER" ]]; then
"$BROWSER" "$openurl"
exit $?
fi
if command -v -- "$BROWSER" >/dev/null 2>&1; then
"$BROWSER" "$openurl"
exit $?
fi
fi
"$open" "$openurl"