fix: expand quoted ~ in install dir and trim trailing slashes on mirror URLs

Addresses Pullfrog review on #24; adds a fixture test for both.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017a5Cv5Z1NzdYKgKnTiAF4E
This commit is contained in:
hermes 2026-09-24 19:34:18 +00:00
commit aabb00d3b7
2 changed files with 21 additions and 0 deletions

View file

@ -190,6 +190,15 @@ main() {
esac
done
# A quoted --dir "~/bin" or IDX_INSTALL_DIR="~/bin" reaches us unexpanded.
# shellcheck disable=SC2088 # matching a literal, unexpanded ~ on purpose
case "$install_dir" in
"~") install_dir="$HOME" ;;
"~/"*) install_dir="$HOME/${install_dir#"~/"}" ;;
esac
github_url="${github_url%/}"
api_url="${api_url%/}"
asset="$(detect_asset)"
tmp_dir="$(mktemp -d 2>/dev/null || mktemp -d -t idx-install)"