fix: prevent double extraction when exclamation mark modifier is used in extract'!'

When using extract'!' with from'gh-r', ziextract was called twice:
1. First by the gh-r download code (line 407) — extracting the archive directly
2. Then by the ∞zinit-extract-hook — calling ziextract --auto --move

On the second call, the .tar.gz was already gone, so --auto mode fell through to file-command detection, which identified .jar files as zip archives
and tried to extract them — corrupting the plugin and producing errors.

Fix: Both the gh-r download path (line 407) and the tarball path (line 272) now skip their direct ziextract call when the extract ice is set,
deferring entirely to the ∞zinit-extract-hook which handles it correctly.
This commit is contained in:
Andrea Alberti 2026-02-15 18:10:33 +01:00
parent d3458542c3
commit 4fd38b34e7
No known key found for this signature in database

View file

@ -267,9 +267,11 @@ builtin source "${ZINIT[BIN_DIR]}/zinit-side.zsh" || {
}
}
# --move is default (or as explicit, when extract'!…' is given)
# Also possible is --move2 when extract'!!…' given
ziextract "$fname" ${ICE[extract]---move} ${${(M)ICE[extract]:#!([^!]|(#e))*}:+--move} ${${(M)ICE[extract]:#!!*}:+--move2}
# When extract ice is set, the ∞zinit-extract-hook will handle
# extraction; otherwise extract here with --move as default.
if (( !${+ICE[extract]} )); then
ziextract "$fname" --move
fi
return 0
) && {
reply=( "$user" "$plugin" )
@ -397,7 +399,11 @@ builtin source "${ZINIT[BIN_DIR]}/zinit-side.zsh" || {
[[ -d ._zinit ]] || return 2
builtin print -r -- $url >! ._zinit/url || return 3
builtin print -r -- ${REPLY} >! ._zinit/is_release${count:#1} || return 4
ziextract ${REPLY:t} ${${${#reply}:#1}:+--nobkp} ${${(M)ICE[extract]:#!([^!]|(#e))*}:+--move} ${${(M)ICE[extract]:#!!*}:+--move2}
# When extract ice is set, the ∞zinit-extract-hook will
# handle extraction; otherwise extract here (no move).
if (( !${+ICE[extract]} )); then
ziextract ${REPLY:t} ${${${#reply}:#1}:+--nobkp}
fi
}
return $?
) || {